Twan, 

The 0-ary version you proposed actually works even nicer with \of.

foo'' = case () of
  () | quux -> ...
     | quaffle -> ...
     | otherwise -> ...

Starting from the above legal haskell multi-way if, we can, switch to 

foo' = case of
  | quux -> ...
  | quaffle -> ...
  | otherwise -> ...

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 

foo = \of | quux -> ...
          | quaffle -> ...
          | otherwise -> ...

and you get wind up with layout starting on the |'s so they line up per-force.

baz = \of 
  Just x  -> Just (x + 1)
  Nothing -> Nothing

avoids an ugly temporary for 

baz' mx = case mx of
  Just x -> Just (x + 1)
  Nothing -> Nothing

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''' below.

bar = \of Just x, Just y -> Just (x + y)
          _     , _      -> Nothing

bar' mx my = case mx, my of
  Just x, Just y -> Just (x + y)
  _     , _      -> Nothing
 
bar'' mx my = case (# mx, my #) of
  (# Just x, Just y #) -> Just (x + y)
  (# _     , _      #) -> Nothing

bar''' (Just x) (Just y) = Just (x + y)
bar''' _ _ = Nothing

-Edward

On Fri, Jul 6, 2012 at 3:12 AM, Edward Kmett <ekmett@gmail.com> wrote:
Oh, neat. I guess it does. :) I'll hack that into my grammar when I get into work tomorrow.

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't change any of the rules for when layout is introduced.

On Jul 5, 2012, at 5:33 PM, Twan van Laarhoven <twanvl@gmail.com> wrote:

> On 2012-07-05 23:04, Edward Kmett wrote:
>> A similar generalization can be applied to the expression between case and of
>> to permit a , separated list of expressions so this becomes applicable to the
>> usual case construct. A naked unparenthesized , is illegal there currently as
>> well. That would effectively be constructing then matching on an unboxed
>> tuple without the (#, #) noise, but that can be viewed as a separate
>> proposal' then the above is just the elision of the case component of:
>
> Should that also generalize to nullarry 'case of'? As in
>
>    foo = case of
>           | guard1 -> bar
>           | guard2 -> baz
>
> instead of
>
>    foo = case () of
>        () | guard1 -> bar
>           | guard2 -> baz
>
>
>
> I realize this is getting off-topic, and has become orthogonal to the single argument λcase proposal.
>
>
> Twan
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users@haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users