<div dir="ltr">Note that similar to the !Nothing example, a bang pattern surfaces the error you'd expect<br><br>Prelude> :set -XBangPatterns<br>Prelude> let !1 = 2<br>*** Exception: <interactive>:2:5-10: Irrefutable pattern failed for pattern 1<br><br>So this exception is lurking about, but due to laziness and the equation's irrelevance, it doesn't show unless you force it with strictness.<br><br>I think the real expectation mismatch here is that numbers are not bindable symbols, so `let 1 = expr in 1` does not rebind 1 to be `expr` like a beginner might think.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">-- Dan Burton</div></div>
<br><div class="gmail_quote">On Thu, Feb 23, 2017 at 11:08 PM, Taeer Bar-Yam <span dir="ltr"><<a href="mailto:taeer@necsi.edu" target="_blank">taeer@necsi.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think the usefulness of numeric / string literals as pattern matches is as<br>
part of larger matches (as someone mentioned), not by itself. But since (I<br>
assume) these things are defined recursively, it makes sense just to add it as a<br>
base-level pattern match.<br>
<br>
Furthermore, you would not want<br>
```<br>
main = let 1 = 2 in print "foo"<br>
```<br>
to error, since the pattern match is unused, and haskell is a lazy language.<br>
Really, though, we probably shouldn't be putting incomplete pattern matches in<br>
our code :P<span class="HOEnZb"><font color="#888888"><br>
<br>
 --Taeer</font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/haskell-caf<wbr>e</a><br>
Only members subscribed via the mailman list are allowed to post.</div></div></blockquote></div><br></div>