[Haskell-cafe] Combining computations

michael rice nowgate at yahoo.com
Sat May 2 21:52:03 EDT 2009

If you look at this stuff long enough it almost begins to make sense. Maybe. ;-)

I've been messing around with MonadPlus and I understand its usage with the Maybe and List monads. Since one use of Monads is combining computations, how can I combine a Maybe with a List?

let m1 = Nothing
let m2 = [1]
let m3 = m1 `mplus` m2  ==> [1]    --if the Maybe is Nothing, do nothing  

let m1 = Just 1 
let m2 = []
let m3 = m1 `mplus` m2  ==> [1]  --if the Maybe is not Nothing, add it to the list

Or am I misunderstanding combining computations?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090502/eeb9bf93/attachment.htm

More information about the Haskell-Cafe mailing list