If we're voting.... I think \of is all right, and multi-argument case could be handy, which rules out using 'case of' for lambda case, because it's the syntax for a 0-argument case:
case of | guard1 -> ... | guard2 -> ... Then multi-argument lambda case could use the comma syntax of multi-argument case. One thing I don't think makes sense in combination is \of with 0-arguments, since any desugaring of that is not going to involve and actual lambda expression. -- Dan On Thu, Jul 5, 2012 at 5:04 PM, Edward Kmett <ekm...@gmail.com> wrote: > I really like the \of proposal! > > It is a clean elision with \x -> case x of becoming \of > > I still don't like it directly for multiple arguments. > > One possible approach to multiple arguments is what we use for multi-argument > case/alt here in our little haskell-like language, Ermine, here at S&P > CapitalIQ, we allow for ',' separated patterns, but without surrounding > parens to be treated as a multi argument case and alt pair. Internally we > desugar our usual top level bindings directly to this representation. When > mixed with the \of extension, this would give you: > > foo :: Num a => Maybe a -> Maybe a -> Maybe a > foo = \of > Just x, Just y -> Just (x*y) > _, _ -> Nothing > > but it wouldn't incur parens for the usual constructor pattern matches and it > sits cleanly in another syntactic hole. > > 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: > > foo mx my = case mx, my of > Just x, Just y -> Just (x*y) > _, _ -> Nothing > > On Jul 5, 2012, at 2:49 PM, wagne...@seas.upenn.edu wrote: > >> Quoting wagne...@seas.upenn.edu: >> >>> Well, for what it's worth, my vote goes for a multi-argument \case. I >> >> Just saw a proposal for \of on the reddit post about this. That's even >> better, since: >> >> 1. it doesn't change the list of block heralds >> 2. it doesn't mention case, and therefore multi-arg \of is perhaps a bit >> less objectionable to those who expect "case" to be single-argument >> 3. 40% less typing! >> >> Can I change my vote? =) >> ~d >> >> _______________________________________________ >> Glasgow-haskell-users mailing list >> Glasgow-haskell-users@haskell.org >> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users > > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users