[Haskell-cafe] Maybe, maybe not.
Daniel Peebles
pumpkingod at gmail.com
Tue Jan 26 23:25:28 EST 2010
There are actually only two (extensionally) possible total functions with
that type, as far as I can see :)
On Tue, Jan 26, 2010 at 11:12 PM, michael rice <nowgate at yahoo.com> wrote:
> 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 <ezyang at MIT.EDU>* wrote:
>
>
> From: Edward Z. Yang <ezyang at MIT.EDU>
> Subject: Re: [Haskell-cafe] Maybe, maybe not.
> To: "michael rice" <nowgate at yahoo.com>
> Cc: "haskell-cafe" <haskell-cafe at haskell.org>
> Date: Tuesday, January 26, 2010, 10:52 PM
>
>
> 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
>
> Cheers,
> Edward
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100126/19420075/attachment.html
More information about the Haskell-Cafe
mailing list