<div>Twan, </div><div><br></div><div>The 0-ary version you proposed actually works even nicer with \of.</div><div><br></div><div><div><font face="courier new, monospace">foo&#39;&#39; = case () of</font></div><div><font face="courier new, monospace">  () | quux -&gt; ...</font></div>
<div><font face="courier new, monospace">     | quaffle -&gt; ...</font></div><div><font face="courier new, monospace">     | otherwise -&gt; ...</font></div></div><div><font face="courier new, monospace"><br></font></div>
<div>Starting from the above legal haskell multi-way if, we can, switch to </div><div><br></div><div><div><font face="courier new, monospace">foo&#39; = case of</font></div><div><font face="courier new, monospace">  | quux -&gt; ...</font></div>
<div><font face="courier new, monospace">  | quaffle -&gt; ...</font></div><div><font face="courier new, monospace">  | otherwise -&gt; ...</font></div></div><div><font face="courier new, monospace"><br></font></div><div>
<div>using the 0-ary form of case as a multi-way if, but since the motivation was to allow the min \of, we get the very terse </div></div><div><br></div><div><div><font face="courier new, monospace">foo = \of | quux -&gt; ...</font></div>
<div><font face="courier new, monospace">          | quaffle -&gt; ...</font></div><div><font face="courier new, monospace">          | otherwise -&gt; ...</font></div><div><font face="courier new, monospace"><br></font></div>
<div>and you get wind up with layout starting on the |&#39;s so they line up per-force.</div><div><font face="courier new, monospace"><br></font></div><div><div><font face="courier new, monospace">baz = \of </font></div><div>
<font face="courier new, monospace">  Just x  -&gt; Just (x + 1)</font></div><div><font face="courier new, monospace">  Nothing -&gt; Nothing</font></div><div><br></div><div>avoids an ugly temporary for </div><div><br></div>
<div><font face="courier new, monospace">baz&#39; mx = case mx of</font></div><div><font face="courier new, monospace">  Just x -&gt; Just (x + 1)</font></div><div><font face="courier new, monospace">  Nothing -&gt; Nothing</font></div>
</div><div><br></div><div>and in the multi-argument case, the resulting syntax is actually comparably noisy to the direct declaration syntax. One , as opposed to two pairs of parentheses in bar&#39;&#39;&#39; below.</div>
<div><br></div><div><div><font face="courier new, monospace">bar = \of Just x, Just y -&gt; Just (x + y)</font></div><div><font face="courier new, monospace">          _     , _      -&gt; Nothing</font></div><div><br></div>
<div><font face="courier new, monospace">bar&#39; mx my = case mx, my of</font></div><div><font face="courier new, monospace">  Just x, Just y -&gt; Just (x + y)</font></div><div><font face="courier new, monospace">  _     , _      -&gt; Nothing</font></div>
<div><font face="courier new, monospace"> </font></div><div><font face="courier new, monospace">bar&#39;&#39; mx my = case (# mx, my #) of</font></div><div><font face="courier new, monospace">  (# Just x, Just y #) -&gt; Just (x + y)</font></div>
<div><font face="courier new, monospace">  (# _     , _      #) -&gt; Nothing</font></div></div><div><br></div><div><font face="courier new, monospace">bar&#39;&#39;&#39; (Just x) (Just y) = Just (x + y)</font></div><div>
<font face="courier new, monospace">bar&#39;&#39;&#39; _ _ = Nothing</font></div><div><br></div><div>-Edward</div><div><br></div><div class="gmail_quote">On Fri, Jul 6, 2012 at 3:12 AM, Edward Kmett <span dir="ltr">&lt;<a href="mailto:ekmett@gmail.com" target="_blank">ekmett@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Oh, neat. I guess it does. :) I&#39;ll hack that into my grammar when I get into work tomorrow.<br>
<br>
My main point with that observation is it cleanly allows for multiple argument \of without breaking the intuition you get from how of already works/looks or requiring you to refactor subsequent lines, to cram parens or other odd bits of syntax in, but still lets the multi-argument crowd have a way to make multi-argument lambdas with all of the expected appropriate backtracking, if they want them. I definitely prefer \of to \case given its almost shocking brevity and the fact that the fact that it introduces a layout rule doesn&#39;t change any of the rules for when layout is introduced.<br>

<div class="HOEnZb"><div class="h5"><br>
On Jul 5, 2012, at 5:33 PM, Twan van Laarhoven &lt;<a href="mailto:twanvl@gmail.com">twanvl@gmail.com</a>&gt; wrote:<br>
<br>
&gt; On 2012-07-05 23:04, Edward Kmett wrote:<br>
&gt;&gt; A similar generalization can be applied to the expression between case and of<br>
&gt;&gt; to permit a , separated list of expressions so this becomes applicable to the<br>
&gt;&gt; usual case construct. A naked unparenthesized , is illegal there currently as<br>
&gt;&gt; well. That would effectively be constructing then matching on an unboxed<br>
&gt;&gt; tuple without the (#, #) noise, but that can be viewed as a separate<br>
&gt;&gt; proposal&#39; then the above is just the elision of the case component of:<br>
&gt;<br>
&gt; Should that also generalize to nullarry &#39;case of&#39;? As in<br>
&gt;<br>
&gt;    foo = case of<br>
&gt;           | guard1 -&gt; bar<br>
&gt;           | guard2 -&gt; baz<br>
&gt;<br>
&gt; instead of<br>
&gt;<br>
&gt;    foo = case () of<br>
&gt;        () | guard1 -&gt; bar<br>
&gt;           | guard2 -&gt; baz<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; I realize this is getting off-topic, and has become orthogonal to the single argument λcase proposal.<br>
&gt;<br>
&gt;<br>
&gt; Twan<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Glasgow-haskell-users mailing list<br>
&gt; <a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users" target="_blank">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br>
</div></div></blockquote></div><br></div>