On 12/6/07, Luke Palmer <[EMAIL PROTECTED]> wrote:
>
> I have actually seen this pattern a lot recently.  Recently I have
> started using a function:
>
> mergeMaybes :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a
> mergeMaybes f Nothing y = y
> mergeMaybes f x Nothing = x
> mergeMaybes f (Just x) (Just y) = Just (f x y)


mergeMaybes = liftM2 -- from Control.Monad
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to