[Haskell-cafe] lambda case
Roman Cheplyaka
roma at ro-che.info
Sat Dec 1 11:30:05 CET 2012
It hasn't made it to the standard yet, though. If some experimental
feature is implemented in GHC, it doesn't mean it's set in stone.
I find this discussion useful — there are some interesting points
(splitting "case of" into two parts) that I don't remember reading in the
original thread (but maybe it's just me).
Roman
* Brent Yorgey <byorgey at seas.upenn.edu> [2012-11-30 09:52:53-0500]
> Oh, PLEASE people. Let's not have another round of bikeshedding about
> this AFTER the feature is already implemented!
>
> -Brent
>
> On Fri, Nov 30, 2012 at 01:25:27PM +0100, Herbert Valerio Riedel wrote:
> > Jon Fairbairn <jon.fairbairn at cl.cam.ac.uk> writes:
> >
> > [...]
> >
> > > “\case” complicates lambda, using “of” simply breaks “case … of …”
> > > into two easily understood parts.
> >
> > Just some observation (I'm rather late to the lambda-case discussion, so
> > this might have been already pointed out previously):
> >
> > if the reserved keyword 'of' was to take the place of '\case', shouldn't
> > then
> >
> > 'case' exp
> >
> > w/o the "'of' { alts }"-part become a separately valid expression (with
> > 'case' essentially meaning 'flip ($)') to really break it up into two
> > independent parts? Then 'case exp of { alts }' wouldn't be a special
> > form anymore, but would just result from combining 'case' and 'of';
> >
> > 'case' wouldn't even need to be a reserved keyword (and thus the grammar
> > could be simplified), if it wasn't for the current grammar which
> > requires to isolate a \case-expression by using () or $, consider e.g.:
> >
> > {-# LANGUAGE LambdaCase #-}
> >
> > import System.Environment
> >
> > case' :: b -> (b -> c) -> c
> > case' = flip ($)
> >
> > main = do
> > s <- getArgs
> >
> > case' s $ \case -- image '\case' was actually '\of' or 'of'
> > [x] -> putStrLn ("Hello " ++ x)
> > _ -> putStrLn "wrong number of arguments given"
> >
> >
> > just my 2¢
> >
> > cheers,
> > hvr
> >
> > _______________________________________________
> > Glasgow-haskell-users mailing list
> > Glasgow-haskell-users at haskell.org
> > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
> >
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Glasgow-haskell-users
mailing list