[Haskell-cafe] Errors in non-monadic code

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Tue Aug 20 00:32:03 CEST 2013


On Tue, Aug 20, 2013 at 12:25:44AM +0200, Jerzy Karczmarczuk wrote:
> Le 20/08/2013 00:19, jabolopes at google.com a écrit :
> >If I understand correctly, by "escaping continuations" you mean that
> >you can easily transfer control between the point where the exception
> >is raised and the exception handler.
> >
> >If this is what you mean, you can achieve the same effect with monadic
> >code by chaining monads together
> 
> José, this is mainly the question of efficiency. You don't need to
> establish contact between the distant stack frames, and you may
> propagate failures if this happens seldom. But if the escaping
> continuation is a frequent case, it might be more economic to
> "jump". This is as simple as that.

That's all very well, in which case I wish implementors of such code would
wrap their possibly-exception-throwing values in a

    newtype ThisMightThrowAnException a = ThisMightThrowAnException a

monad.  Then at least we'd all know.

Tom




More information about the Haskell-Cafe mailing list