[Haskell-cafe] (SPAM 3)Re: handling NULL value in database query with Maybe (or other ...)

Damien Mattei mattei at oca.eu
Tue Dec 18 15:34:15 UTC 2018

ok well i do not want to open a discussion here, but i do not see any
benefit in Haskell using Nothing and Just compared to other language,
it's the same than if i had written in C something like :
if (x == NULL)

i expected more from Haskell...

ok reading twice the article in link, i admit there should be some
adavantage using Nothing instead of null, such as type, and genericity
and not being spcecific to alloated memory as in C ...

Le 18/12/2018 16:16, Tom Ellis a écrit :
> That is using Maybe and is not a null pointer!
> Just and Nothing are the constructors of Maybe.
> On Tue, Dec 18, 2018 at 03:43:35PM +0100, Damien Mattei wrote:
>> thank you Tom, it is the kind of answer that help me
>> i insert this and it is ok now:
>> forM_ bd_rows_WDS $ \(Only x) ->
>>       case x of
>>         Nothing -> putStrLn ("x =" ++ "NULL")
>>         Just x -> putStrLn $ ("x =" ++ Text.unpack x)
>> i had seen a such solution on web but thought the Maybe was the
>> solution, i hoped asked could avoid using sort of Null pointer as
>> mentioned in this article:
>> https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/
>> if someone else have a simpler solution email me
>> Le 18/12/2018 13:34, tom.stejskal a écrit :
>>> case x of
>>>     Nothing -> putStrLn "NULL"
>>>     Just y -> putStrLn $ Text.unpack y
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

Damien.Mattei at unice.fr, Damien.Mattei at oca.eu, UNS / OCA / CNRS

More information about the Haskell-Cafe mailing list