[Haskell-beginners] MonadPlus
Johann Bach
johann.bach1127 at gmail.com
Wed Jul 28 06:03:01 EDT 2010
I'm looking at Douglas Auclair's MonadPlus article, here
http://www.haskell.org/sitewiki/images/6/6a/TMR-Issue11.pdf
So consider an example like
t2 = do
x <- [1,2,3]
y <- [1,2]
guard $ x+y > 2
return (x,y)
This uses the list instance of MonadPlus.
Now, Douglas is talking about his own code, not the above example, but
his own code is similar. And he says "the entire computation is
chained by mplus". I'm confused because I thought it was chained by
>>=. In fact, I can't see where the above code makes use of mplus. The
definition of "guard" uses mzero.
More information about the Beginners
mailing list