[Haskell-cafe] handling NULL value in database query with Maybe (or other ...)
Damien Mattei
mattei at oca.eu
Tue Dec 18 14:43:35 UTC 2018
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
--
Damien.Mattei at unice.fr, Damien.Mattei at oca.eu, UNS / OCA / CNRS
More information about the Haskell-Cafe
mailing list