purescript-parallel icon indicating copy to clipboard operation
purescript-parallel copied to clipboard

Instance for `Eff`?

Open natefaubion opened this issue 9 years ago • 7 comments

Is there a reason for there to not be an instance for Eff proper? I know in JS its "technically" not parallel. But if Eff was implemented on a true multi-threaded platform like the JVM, it definitely would be possible. Also I'd argue that a MonadPar instance for Eff is no different than MonadPar for Aff where you liftEff everything.

natefaubion avatar Aug 19 '16 14:08 natefaubion

I think it's a reasonable law that par f x y be observationally identical to par (flip f) y x and that seems false for Eff.

paf31 avatar Aug 19 '16 16:08 paf31

That law does not necessarily hold for Aff.

natefaubion avatar Aug 19 '16 16:08 natefaubion

In fact it doesn't hold for anything that supports synchronicity on platforms without multithreading.

natefaubion avatar Aug 19 '16 16:08 natefaubion

Is the suggested instance par = liftA2?

paf31 avatar Aug 19 '16 16:08 paf31

The suggested instance is implemented via the FFI, such that a platform that has true multithreading could have a better implementation.

natefaubion avatar Aug 19 '16 16:08 natefaubion

But yes, for the JS platform, that's what it would be.

natefaubion avatar Aug 19 '16 16:08 natefaubion

I'm guessing this issue applies to Effect now rather than Eff.

JordanMartinez avatar Dec 04 '21 16:12 JordanMartinez