[Haskell-cafe] Stacking monads

Jake McArthur jake at pikewerks.com
Fri Oct 3 16:26:22 EDT 2008


Andrew Coppin wrote:
> I was thinking more, why not just delete MonadPlus completely, and 
> have any function that needs a monad that's also a monoid say so in 
> its context? (Obviously one of the answers to that is "because it 
> would break vast amounts of existing code".) 
Because they are not the same. MonadPlus has more restrictions than 
Monoid. For an instance of the form "instance MonadPlus m where", m a 
_must_ be a Monoid for _all_ a, whereas "instance Monoid (m a) where" 
may be defined for some specific a instead.

- Jake


More information about the Haskell-Cafe mailing list