Asynchronous computations and error handling in the free monad

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Asynchronous computations and error handling in the free monad

Damian Nadales
Yesterday I posted the following question to SO:
    http://stackoverflow.com/questions/40495304/abstract-result-types-in-free-monads

As discussion with Benjamin ensued, in which he stated that it is
better to be explicit about the fact that we want parts of our code to
run asynchronously. I am not so sure.

I also have a similar question about how would you deal with fatal
errors that could happen at the interpreter. I guess this could be
modeled in the free monad by having a command returning a `Maybe` or
`Either` type. However we're adding details about the interpreters in
our DSL, since we are stating that certain command could cause fatal
errors.

So my question is what approach do you or would you use?
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Asynchronous computations and error handling in the free monad

Will Yager
Without knowing exactly what the problem is, perhaps you could use "FreeT ast Either"?

This will allow you to extend the Free monad with failure semantics.

Will


> On Nov 9, 2016, at 15:34, Damian Nadales <[hidden email]> wrote:
>
> Yesterday I posted the following question to SO:
>    http://stackoverflow.com/questions/40495304/abstract-result-types-in-free-monads
>
> As discussion with Benjamin ensued, in which he stated that it is
> better to be explicit about the fact that we want parts of our code to
> run asynchronously. I am not so sure.
>
> I also have a similar question about how would you deal with fatal
> errors that could happen at the interpreter. I guess this could be
> modeled in the free monad by having a command returning a `Maybe` or
> `Either` type. However we're adding details about the interpreters in
> our DSL, since we are stating that certain command could cause fatal
> errors.
>
> So my question is what approach do you or would you use?
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.