<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Yes. You're just using record pattern match with no records. Why
would it be unexpected?<br>
</p>
<div class="moz-cite-prefix">On 30.11.2023 14:46, Noon van der Silk
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKBUzA3n6yYkY8kXi2Z5RsA0Fwy-9g_h8bSmRznQVSU=NOTXxA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Sometimes I have a type like:
<div><br>
</div>
<div> data A = A1 Int | A2 Int Int</div>
<div><br>
</div>
<div>Then if I want to do pattern matching and ignore the
parameters I do:</div>
<div><br>
</div>
<div> f (A1 _) = ..</div>
<div> f (A2 _ _) = ...</div>
<div><br>
</div>
<div>But that's annoying; I need to remember how many parameters
each one has!</div>
<div><br>
</div>
<div>Yesterday I learned I can just do this:</div>
<div><br>
</div>
<div> f A1 {} = ...</div>
<div> f A2 {} = ...</div>
<div><br>
</div>
<div>And GHC is happy.</div>
<div><br>
</div>
<div>Is this expected? Am I the last to learn about this trick?</div>
<div>
<div><br>
</div>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div dir="ltr">Noon van der Silk, ن<br>
<br>
<a href="http://silky.github.io/" target="_blank"
moz-do-not-send="true" class="moz-txt-link-freetext">http://silky.github.io/</a><br>
<br>
"My programming language is kindness."</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
</blockquote>
</body>
</html>