[Haskell-cafe] Re: what is inverse of mzero and return?
Keean Schupke
k.schupke at imperial.ac.uk
Sat Jan 22 18:33:52 EST 2005
Daniel Fischer wrote:
> That's probably a misunderstanding due to the notation, in the []
> monad, it's
>
>just
>
>concat (map c (a ++ b)) = concat (map c a) ++ concat (Map c b),
>
>which is easily seen to be true (if applying c to an element of a causes an
>error, neither side will go past that).
>
>Daniel
>
>
So do we consider [] to be fail?, Monad.hs defines:
instance MonadPlus [] where
mzero = []
mplus = (++)
What would happen if this was the definition?
instance MonadPlus [] where
mzero = []
mplus a b
| a == [] = b
| otherwise = a
Keean.
More information about the Haskell-Cafe
mailing list