<div dir="ltr"><div>Maybe a is a sum type.<br></div><div><br></div>Show instance for sum types displays the constructor.<div><br></div><div>For example, if we used another sum type:</div><div>Either Int Int,</div><div>then </div><div>Left 23 /= Right 23</div><div><br></div><div>So we'd be interested to see the constructor to tell them apart. 23 wouldn't be sufficiently clear.</div><div><div><br></div><div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 13, 2020 at 5:18 PM Velichko Lefterov <<a href="mailto:velichko.lefterov@gmail.com">velichko.lefterov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">The function returns Maybe a.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 13, 2020 at 5:16 PM Alexander Chen <<a href="mailto:alexander@chenjia.nl" target="_blank">alexander@chenjia.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-family:Arial;font-size:13px">I expected <div><br></div><div>prelude> safeHead <span style="font-size:14px;white-space:pre-wrap;font-family:Consolas,"Courier New",monospace;color:rgb(14,104,2)">[23,1,4,2,4,2]</span></div><div><font color="#0e6802" face="Consolas, Courier New, monospace"><span style="font-size:14px;white-space:pre-wrap">23</span></font></div><div><font color="#0e6802" face="Consolas, Courier New, monospace"><span style="font-size:14px;white-space:pre-wrap"><br></span></font></div><div><font color="#0e6802" face="Consolas, Courier New, monospace"><span style="font-size:14px;white-space:pre-wrap">not
<br>Just 23<br></span></font><br><div>May 13, 2020 4:11:47 PM CEST Imants Cekusins <<a href="mailto:imantc@gmail.com" target="_blank">imantc@gmail.com</a>> wrote:<blockquote type="cite"><div dir="ltr"><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:Consolas,"Courier New",monospace;font-size:14px;white-space:pre-wrap">prelude> </span><font face="Consolas, Courier New, monospace"><span style="font-size:14px;white-space:pre-wrap">safeHead [23,1,4,2,4,2]<br></span></font><font face="Consolas, Courier New, monospace"><span style="font-size:14px;white-space:pre-wrap">Just 23</span></font></blockquote></div><div style="font-family:Arial;font-size:13px"><font face="Consolas, Courier New, monospace"><span style="font-size:14px;white-space:pre-wrap"><br></span></font></div>Looks good.<div><br></div><div>What did you expect to see?</div></div>
<pre style="font-size:13px">_______________________________________________<br>Beginners mailing list<br><a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br></pre></blockquote></div><br><br><div><div style="font-family:Arial;font-size:13px"><br></div></div></div></div>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>