[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:

http://haskell.org/ghc/docs/latest/html/libraries/base-4.2.0.0/src/Data-Maybe.html#fromMaybe

-- | 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}

and

http://en.wikibooks.org/wiki/Haskell/Hierarchical_libraries/Maybe

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


Michael




      
-------------- 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