[Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread michael rice
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

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Edward Z. Yang
Excerpts from michael rice's message of Tue Jan 26 21:34:42 -0500 2010: fromMaybe d x = case x of {Nothing - d;Just v  - v} fromMaybe z = maybe z id They're equivalent. Here the definition of maybe: maybe :: b - (a - b) - Maybe a - b maybe n _ Nothing = n maybe _ f (Just x) = f x

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread michael rice
Didn't recognize the sameness. Aside from there being many ways to do the same thing, partial application makes the mixup even merrier. Thanks, Michael --- On Tue, 1/26/10, Edward Z. Yang ezy...@mit.edu wrote: From: Edward Z. Yang ezy...@mit.edu Subject: Re: [Haskell-cafe] Maybe, maybe

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Daniel Peebles
the mixup even merrier. Thanks, Michael --- On *Tue, 1/26/10, Edward Z. Yang ezy...@mit.edu* wrote: From: Edward Z. Yang ezy...@mit.edu Subject: Re: [Haskell-cafe] Maybe, maybe not. To: michael rice nowg...@yahoo.com Cc: haskell-cafe haskell-cafe@haskell.org Date: Tuesday, January 26

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Edward Z. Yang
Excerpts from Daniel Peebles's message of Tue Jan 26 23:25:28 -0500 2010: There are actually only two (extensionally) possible total functions with that type, as far as I can see :) Is the other one... const? Cheers, Edward ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Ivan Miljenovic
2010/1/27 Edward Z. Yang ezy...@mit.edu: Excerpts from Daniel Peebles's message of Tue Jan 26 23:25:28 -0500 2010: There are actually only two (extensionally) possible total functions with that type, as far as I can see :) Is the other one... const? As far as I can tell, yes. -- Ivan Lazar

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Tony Morris
It might be more obvious by giving: fromMaybe :: a - (a - x, x) - x Ivan Miljenovic wrote: 2010/1/27 Edward Z. Yang ezy...@mit.edu: Excerpts from Daniel Peebles's message of Tue Jan 26 23:25:28 -0500 2010: There are actually only two (extensionally) possible total functions with

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Ivan Miljenovic
2010/1/27 Tony Morris tonymor...@gmail.com: It might be more obvious by giving: fromMaybe :: a - (a - x, x) - x I actually found this more confusing, and am not sure of its validity: should that be Maybe a there at the beginning? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com

Re: [Haskell-cafe] Maybe, maybe not.

2010-01-26 Thread Tony Morris
Ivan Miljenovic wrote: 2010/1/27 Tony Morris tonymor...@gmail.com: It might be more obvious by giving: fromMaybe :: a - (a - x, x) - x I actually found this more confusing, and am not sure of its validity: should that be Maybe a there at the beginning? Sorry a mistake.