
To summarize: Monad isn't the proper abstraction for failable/Maybe. Maybe is an algebraic data type that *exactly* represents the spirit of what you're trying to do: e.g. Conor McBride said: "Maybe is the most general abstraction. Requiring (>>=), or even (<*>) seems excessive. What we need is "any f with zero and return", so why not pick the canonical, initial, inductively defined such thing?" In this case the typeclass adds no generality to the function's behaviour (Maybe can be trivially converted to any other type, with a combinator even). And the confusion that results, when the function is almost always used at type Maybe anyway. If you want to read the whole discussion... if you haven't been subscribed to libraries@haskell.org , it's archived: http://thread.gmane.org/gmane.comp.lang.haskell.libraries/9082
Thanks for the summary. I had been wondering about this change of mood, and I disagree with the suggestion that Maybe Nothing is the right replacement for Monad fail. Whether fail should be in Monad, or whether we really want MonadZero, MonadPlus, MonadError, or something else entirely has been open for discussion, but it is easily shown that Maybe is not the most general abstraction - it loses information wrt to (Either String), for instance: Prelude> let {f [] = fail "empty"; f [_] = fail "singleton"; f l = return l } Prelude> f [] :: Maybe [Bool] Nothing Prelude> f [True] :: Maybe [Bool] Nothing Prelude> f [True,False] :: Maybe [Bool] Just [True,False] Prelude> Prelude> :m +Control.Monad.Error Prelude Control.Monad.Error> f [] :: Either String [Bool] Left "empty" Prelude Control.Monad.Error> f [True] :: Either String [Bool] Left "singleton" Prelude Control.Monad.Error> f [True,False] :: Either String [Bool] Right [True,False] You can specialise Monad to Maybe, but you can't get back to the general handling of failure without losing the failure messages! Choosing Maybe over (Either String) means: "I don't care about the failure messages" (not that String is necessarily the best way to represent failure conditions, but that is another story again). As anyone who has ever tried to use a Parser based on that choice can attest, that choice should not be taken lightly ("Compilation failed. There were errors."). Claus