purescript/purescript-parallel

Instance for `Eff`?

natefaubion opened this issue · 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.

paf31 commented

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.

That law does not necessarily hold for Aff.

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

paf31 commented

Is the suggested instance par = liftA2?

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

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

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