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

Damien Mattei mattei at oca.eu
Thu Dec 20 09:38:41 UTC 2018

Le 19/12/2018 20:35, Ian Denhardt a écrit :
> Quoting Sven Panne (2018-12-19 09:03:21)
>>    I think Ian just wanted to demonstrate that it is possible to crash
>>    Haskell programs in the same way as C programs if you really want to.
>>    OTOH,
>> the name "unsafeCoerce" 
all is in the name... ;-) it's unsafe and coercitive... i will always
try to avoid this in my code...

of the function used and its type (a ->
>> b) alone should be very visible warning signs. ;-) Mere mortals should
>> better forget about its existence,
> ..and this was more my point -- while it *is* possible to cause the
> same bad behavior in Haskell as in C, the language is constructed in
> such a way that it's hard to do so by accident.
>>      Ian, by the way, how can you guarantee that Segmentation
>>      Fault will not happen in Haskell application?
> You can't, and indeed it has happened in the past, sometimes due to
> compiler bugs, sometimes due to misuse of stuff like unsafeCoerce or the
> FFI.
> But it's literally never happened to me personally.
> My point is it's not about guarantees so much as whether getting things
> right is easy. Forgetting to check for NULL in C is a massive source of
> real-world bugs. Forgetting to check for Nothing in Haskell isn't.
> Note that the distinction *does* matter if you're thinking of building
> something like lambdabot, where you may be running malicious code. But
> for most purposes it doesn't.
> _______________________________________________
> 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