<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>This works too:</div><div><br></div><div>    Nothing = Just "hello"</div><div><br></div><div>so you get the same effect even without any literal number specialness.</div><div><br></div><div>Even this:</div><div><br></div><div>    Just x = Nothing</div><div><br></div><div>also "works" until you force evaluation of x, as an irrefutable (lazy) pattern match. So in a way, you could view the first case as a lazy pattern match in which there is nothing you could possibly force, so there's no way to manifest the pattern match failure.</div><div><br></div><div>Just another way of looking at it.</div><div><br></div><div>JEff</div><div><br>On Feb 23, 2017, at 7:00 PM, Brandon Allbery <<a href="mailto:allbery.b@gmail.com">allbery.b@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">It is, yes. (Literal numbers in patterns occasionally have unexpected type ramifications as a result; and occasionally others, since the compiler rewrites the pattern match into a guard. It's one of those things that Just Works 99% of the time and then makes you tear your hair out.)</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 23, 2017 at 9:56 PM, Harendra Kumar <span dir="ltr"><<a href="mailto:harendra.kumar@gmail.com" target="_blank">harendra.kumar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My first guess was a pattern match, but it sounded a bit odd because there is no explicit constructor in case of numbers.  If there were an explicit constructor it would have been easier to imagine this as a pattern match. This seems to be a weird side effect of the special handling of numbers.<span class="HOEnZb"><font color="#888888"><div><br></div><div>-harendra</div></font></span><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 24 February 2017 at 07:37, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Thu, Feb 23, 2017 at 9:05 PM, Harendra Kumar <span dir="ltr"><<a href="mailto:harendra.kumar@gmail.com" target="_blank">harendra.kumar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Kids have this amazing ability to break any toy in minutes. I gave my seven year old daughter ghci to play with and in a little while she said it is broken:<div>







<p class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-p1"><span class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-s1">>> let 1 = 2</span></p>
<p class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-p1"><span class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-s1">>> 1</span></p>
<p class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-p1"><span class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-s1">1</span></p>
<p class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-p1"><span class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-s1">>> </span></p><p class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-p1"><span class="m_2025218079870128664m_-1919096904227003041m_3749249878251812522gmail-s1">Earlier, I had explained to her about symbols and assigning values to symbols, and I said numbers are not symbols. But when she came up with this I could not explain what's going on. How can "1 = 2" be a valid equation? Am I missing something fundamental here, or it is just broken?</span></p></div></div></blockquote></span><div>It's a pattern match. The match fails, but as it produced no bindings it cannot be observed and its success or failure is irrelevant. <span class="m_2025218079870128664HOEnZb"><font color="#888888"><br></font></span></div></div><span class="m_2025218079870128664HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_2025218079870128664m_-1919096904227003041gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</font></span></div></div>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Haskell-Cafe mailing list</span><br><span>To (un)subscribe, modify options or view archives go to:</span><br><span><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a></span><br><span>Only members subscribed via the mailman list are allowed to post.</span></div></blockquote></body></html>