Could this be done in Aff?

Just yesterday I published an async package I was working on that is basically Elm tasks


I’m wondering if this would have been possible to implement with
newtype Task x a = Task (Aff (x \/ a))

I tried that approach and could get most of the way there, but I ultimately gave up when it came to ParTasks (the parallel version of Task) being canceled if chained together via apply and one of them errors. However, I recognize I am no Aff master, so I’m curious of any of you can cook up a way to implement this library with Aff. On the flip side, if you can explain exactly why it can’t be done, that would be cool too.

Edit: I believe

newtype Task x a = Task (ExceptT x Aff a)

would be a more appropriate representation.

1 Like

See https://github.com/purescript-contrib/purescript-aff/issues/137

1 Like

Interesting. added my :+1:

1 Like