[Haskell-cafe] Maybe a, The Rationale

Philip Weaver philip.weaver at gmail.com
Sat May 10 20:41:58 EDT 2008


On Sat, May 10, 2008 at 3:10 PM, PR Stanley <prstanley at ntlworld.com> wrote:
>
>>>>>       Paul: 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. :-)
>>>>
>>>>       Bob: 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.
>>>
>>>       Paul: Would yu like to demonstrate this in an example?
>>
>>
>> Um, I was encountering and recognizing times when I really needed an
>> out-of-band "null", and the pain of representing such in C, shortly
>> after I started serious programming in C (call it 1984-5).  Is this
>> really difficult?
>
>
>        Paul: Hmm, I'm not quite sure what you're driving at.
>
Me neither.
>                Cheers, Paul
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list