[Haskell-beginners] Maybe monad and computations

Daniel Trstenjak daniel.trstenjak at gmail.com
Sat Sep 7 10:28:38 CEST 2013



Am 07.09.2013 um 10:01 schrieb Emmanuel Touzery <etouzery at gmail.com>:

> I got an helpful answer on stackoverflow that probably explains it all. Otherwise if i add the type, i'll have to bind it to a concrete monad due to the lack of typeclasses, that's why i didn't put a type. Thanks again.
> 
Ok, that explains a lot.

But if you need this kind of operation a lot, you could still have something like:

liftMaybe2 :: (a -> b -> c) -> Maybe a -> Maybe b ->  Maybe c
liftMaybe2 f (Just a) (Just b) = Just $ f a b
liftMaybe2 _ _ _                    = Nothing


Greetings,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130907/7ea82956/attachment.htm>


More information about the Beginners mailing list