|
GHC rejects empty case: msg#00080lang.haskell.glasgow.bugs
The H98 report says: exp -> case exp of { alts } alts -> alt1 ; ... ; altn (n>=1) alt -> pat -> exp [where decls] | pat gdpat [where decls] | (empty alternative) Since an alt can be empty, these ought to be legal: case e of { } case e of { ; } However, GHC 5.04.2 rejects them ("parse error on input `}'"). The report also says: A case expression must have at least one alternative and each alternative must have at least one body. But this "at least one body" rule, if strictly interpreted, seems to contradict the "empty alternative" production. And anyway GHC accepts this: case e of { _ -> e; ; } which clearly contains several empty alternatives. So I don't see why a case expression consisting of _only_ empty alternatives couldn't be accepted. (No, I don't claim this to be particularly useful for anything. :) Lauri Alanko la@xxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: -fwarn-unused-matches, Simon Peyton-Jones |
|---|---|
| Next by Date: | build of GHCi 5.04.3 fails to work (libgcc.a), Aaron Denney |
| Previous by Thread: | [ ghc-Bugs-604466 ] x86 NCG bug with stdcall f.i. "wrapper", SourceForge.net |
| Next by Thread: | Re: GHC rejects empty case, Ross Paterson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |