[Haskell-cafe] ANN: asynchronous-exceptions
david.sorokin at gmail.com
Wed Feb 5 17:44:54 UTC 2014
Please let me add two cents to your discussion. Just for your information.
There is a working approach, when the exceptions can be indeed successfully caught within the asynchronous computation. Moreover, there is also the working try-finally block, which is more difficult to implement. This is the async workflow in F# and their Async<’T> type is actually a monad. Only they use the continuations, namely three continuations: (1) the main branch; (2) the branch for catching exceptions; (3) the branch for immediate canceling the computation. They have no special «asynchronous» exceptions that would differ from synchronous ones.
By the way, I have implemented a similar approach in my library aivika available on hackage (module Simulation.Aivika.Internal.Cont). I can catch the IO exceptions as well as I can process so called the finally blocks, and my own tests show that it works in Haskell.
More information about the Haskell-Cafe