a monadic if or case?

Andrew J Bromage ajb@spamcop.net
Fri, 14 Feb 2003 11:42:14 +1100

G'day all.

On Thu, Feb 13, 2003 at 02:54:42PM -0500, David Roundy wrote:

> That's pretty nice (although not quite as nice as it would be to be able to
> use real ifs with no extra parentheses).  Any idea how to do something like
> this with a case? http://www.haskell.org/mailman/listinfo/haskell-cafe

In the case of Maybe, what you're really trying to do there is a kind of
exception handling.  You may or may not be better off using a real
exception monad transformer on top of IO (or whatever the underlying
monad is).

One possibility is Control.Monad.Error (fromt he MTL).  Here's another


I know this didn't directly answer your question, but it's good to
explore the design space.

Andrew Bromage