[Haskell-beginners] MonadError example
giacomo at tesio.it
Mon Nov 12 01:04:50 CET 2012
Hi, I'm looking from an example of MonadError usage for exception handling.
After reading this http://mvanier.livejournal.com/5343.html I'd like to see
an example with two different error types handled in the same function.
I mean I have
f :: a -> Either e1 b
g :: b -> Either e2 c
and I want to write a new function
z :: a -> Either e3 c
using f and g.
(with Either e1, Either e2 and Either e3 all instances of MonadError)
e3 could provide constructors like E1Occurred e1 and E2Occurred e2 (to
mimic inner exceptions)
I'd like to see how readable would be z.
Can you point me to a snippet or even a real codebase showing such thing?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners