[Haskell-cafe] Maybe, maybe not.

michael rice nowgate at yahoo.com
Tue Jan 26 21:34:42 EST 2010

Just noticed this difference in the definition of fromMaybe in two different places:


-- | The 'fromMaybe' function takes a default value and and 'Maybe'
-- value.  If the 'Maybe' is 'Nothing', it returns the default values;
-- otherwise, it returns the value contained in the 'Maybe'.
fromMaybe     :: a -> Maybe a -> a
fromMaybe d x = case x of {Nothing -> d;Just v  -> v}



fromMaybe :: a -> Maybe a -> a
fromMaybe z = maybe z id


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100126/d74fee01/attachment.html

More information about the Haskell-Cafe mailing list