Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Runtime representation of eff is leaked #30

Closed
safareli opened this issue Dec 12, 2017 · 4 comments
Closed

Runtime representation of eff is leaked #30

safareli opened this issue Dec 12, 2017 · 4 comments

Comments

@safareli
Copy link

safareli commented Dec 12, 2017

Currently runtime representation of Eff is leaked to all libraries defining new Effs using FFI

If

  • the representation was (or was assumed to be) some opaque structure
  • and clients used only require('output/Control.Monad.Eff.Unsafe/index.js').unsafePerformEff to run effect

for FFI-ing effectful code instead we could have done:

foreign import data ForiegnFff :: # Effect -> Type -> Type
toEff :: forall e a. ForiegnFff e a -> Eff e a
toEff = unsafeCoerce

libs will use ForiegnFff type for doing FFI and then toEff for actually using it.

This way representation could be changed (for example #29) without effecting users, (without major version change).

@safareli
Copy link
Author

I think we should start making current representation opaque, and update all deps gradually.
If folks agree on it i could open pr to address this issue here.

@paf31
Copy link
Contributor

paf31 commented Dec 12, 2017

I don't really see why this is a problem. Eff is just one possible representation of an effectful function, and if you want to use it, you need to know its representation. Adding a layer of indirection like this would be appropriate if we wanted Eff to be the only possible representation, but it's not.

@safareli
Copy link
Author

like if we create an lib purescript-feff (for FFI Eff) Which is basically:

foreign import data FEff :: # Effect -> Type -> Type
foreign import unsafePerformFEff :: forall eff a. FEff eff a -> a

Then the Eff could even be implemented in PS, and it would be possible to update Eff internal representation without braking everything

@hdgarrood
Copy link
Contributor

Shall we close this? I agree with Phil's comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants