[Haskell-cafe] Errors in non-monadic code

jabolopes at google.com jabolopes at google.com
Tue Aug 20 00:19:47 CEST 2013

> Some exceptions, e.g. in the traversal of deep structures may be and
> ARE used as escaping continuations.

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, for example, you can have your
structure traversal code as several 'Maybe' functions.

And if I understand correctly the underlying technical details of
Haskell, because of continuation-passing style, the "control transfer"
should be simpler because it comes down to invoking the proper
continuation, so all of that code that compilers have to generate to
look into the stack and find the proper exception handler, and unwind
the stack and transfer control, is avoided.


More information about the Haskell-Cafe mailing list