<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 2018-12-18 7:43 AM, Damien Mattei wrote:<br>
<blockquote type="cite" cite="mid:5C190797.3080701@oca.eu">i hoped
asked could avoid using sort of Null pointer as mentioned in this
article:<br>
<a class="moz-txt-link-freetext" href="https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/">https://www.lucidchart.com/techblog/2015/08/31/the-worst-mistake-of-computer-science/</a><br>
if someone else have a simpler solution email me</blockquote>
<br>
You can avoid it: make the DNUM column non-NULL in your database
schema. That "worst mistake" applies to databases as well as
programming languages! :-)<br>
<br>
If you have to allow NULL in the database, then you have to handle
Nothing in your code. However, a neater way of doing it is to use
the maybe function:<br>
<pre class="moz-quote-pre" wrap="">forM_ bd_rows_WDS $ \(Only x) ->
putStrLn $ "x =" ++ maybe "" Text.unpack x
</pre>
<br>
This allows you to provide a default value in your code for when the
column is NULL.<br>
</body>
</html>