« Return to Thread: Maybe a, The Rationale

Re: Maybe a, The Rationale

by Thomas Davie :: Rate this Message:

Reply to Author | View in Thread


On 11 May 2008, at 00:36, PR Stanley wrote:

> Hi folks
>
> data Maybe a = Nothing | Just a
>
> What is the underlying rationale for the Maybe data type? is it the  
> safe style of programming it encourages/
> Something tells me this is going to start a lengthy discussion. :-)

Pure and simple -- it allows you to represent partial functions.  
Looking up a map will only sometimes find a value, so we either return  
Nothing, or Just that value.

Bob
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

 « Return to Thread: Maybe a, The Rationale

LightInTheBox - Buy quality products at wholesale price