r/purescript • u/VigVigorish • Oct 04 '20
Getting the value from Aff to Effect
Why there isn't a function so that i can run the Aff in Effect and get its value ? All i can find is launchAff but that returns Fiber a and if i run the Fiber it returns Unit in Effect , i would assume it returns the value but no.
7
Upvotes
View all comments
Show parent comment
2
u/Herku Oct 06 '20
No, liftAff allows you to lift an aff into any other async effect context (MonadAff, e.g. a monad transformer stack) but not into Effect. Effect has no MonadAff instance. The is no way to "wait" in Effect, that is literally the reason why there is Aff. As I said above you can use
runAff_and then run an effectful callback function. But there is no natural transformationAff ~> Effect. You seem very stuck on your particular problem that you want to avoid looking outside of the obvious solution that does not work.