<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Mmm, yes of course... blush...<br>
<br>
But shouldn't <br>
<pre wrap="">f ~(x:xs) = rhs</pre>
give a compile-time error since neither x nor xs is used in the right
hand side, and hence nothing will ever get pattern matched when this
function is called, which clearly indicates a mistake? That is, if I
understand lazy pattern matching correctly... And then in these cases
the user would have to annotate the pattern match as being strict, so
he is aware of the eager evaluation taking place<br>
<br>
Oh well, the way it is now is also easy to get used to, one just has to
know how it works (just like M-theory <span class="moz-smiley-s3"><span>
;-) </span></span>)<br>
<br>
Cheers,<br>
Peter<br>
<br>
<br>
Neil Mitchell wrote:
<blockquote
cite="mid:404396ef0709190353s3537a7efkc8b863af0841f264@mail.gmail.com"
type="cite">
<pre wrap="">Hi
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap=""> Now why isn't pattern matching lazy by default? This seems odd for a
newbie since everything else is lazy by default.
</pre>
</blockquote>
</blockquote>
<pre wrap=""><!---->
f ~(x:xs) = rhs
f ~[] = rhs'
Now guess what f [] does...
If you use a where binding then pattern matching is lazy.
Thanks
Neil
</pre>
</blockquote>
<br>
</body>
</html>