diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-04 10:27:38 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-04 10:27:38 +0000 |
commit | 3671e674757c8f82ec1f0ea9b7c1ed56340b55bc (patch) | |
tree | 9c875d12dc2817df632c4f801278bfdfda4c8b93 /compiler/parser/Parser.y.pp | |
parent | 28d9a03253e8fd613667526a170b684f2017d299 (diff) | |
download | haskell-3671e674757c8f82ec1f0ea9b7c1ed56340b55bc.tar.gz |
Allow empty case expressions (and lambda-case) with -XEmptyCase
The main changes are:
* Parser accepts empty case alternatives
* Renamer checks that -XEmptyCase is on in that case
* (Typechecker is pretty much unchanged.)
* Desugarer desugars empty case alternatives, esp:
- Match.matchWrapper and Match.match now accept empty eqns
- New function matchEmpty deals with the empty case
- See Note [Empty case alternatives] in Match
This patch contains most of the work, but it's a bit mixed up
with a refactoring of MatchGroup that I did at the same time
(next commit).
Diffstat (limited to 'compiler/parser/Parser.y.pp')
-rw-r--r-- | compiler/parser/Parser.y.pp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index e3f4994166..b6139621d1 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -1712,6 +1712,8 @@ guardquals1 :: { Located [LStmt RdrName (LHsExpr RdrName)] } altslist :: { Located [LMatch RdrName (LHsExpr RdrName)] } : '{' alts '}' { LL (reverse (unLoc $2)) } | vocurly alts close { L (getLoc $2) (reverse (unLoc $2)) } + | '{' '}' { noLoc [] } + | vocurly close { noLoc [] } alts :: { Located [LMatch RdrName (LHsExpr RdrName)] } : alts1 { L1 (unLoc $1) } |