[Haskell-cafe] Re: nested maybes

Yitzchak Gale gale at sefer.org
Mon Feb 5 09:38:25 EST 2007

I wrote:
>> Why go to the trouble of creating a new monad?
>> The existing ones are fine.

J. Garrett Morris wrote:
> Mainly to keep the type error messages simpler.

There are two ways to get around that problem:

1. Make your functions polymorphic, using
MonadState, MonadError, etc. Each function
mentions only the capabilities that it needs,
without having the whole monad stack in its type.

2. Use a type alias for the monad stack.

(There are other big advantages of both of these.)


More information about the Haskell-Cafe mailing list