#2431: allow empty case analysis
---------------------------------+------------------------------------------
Reporter: RalfHinze | Owner:
Type: feature request | Status: new
Priority: low | Milestone: _|_
Component: Compiler | Version: 6.8.3
Severity: minor | Resolution:
Keywords: empty case analysis | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
---------------------------------+------------------------------------------
Changes (by simonpj):
* priority: normal => low
* milestone: 6.12 branch => _|_
Comment:
OK so I don't like GHC crashing, ever, so I have done the following:
* In the renamer and typechecker, I allow empty `HsCase`.
* In Core I still don't allow empty `Case`. I have no idea what stuff
would break if empty `Case` was allowed; but even finding the type of an
expression might become impossible. (Yes, at the moment `Case` records
its result type, but with the new FC stuff that's not necessary and I may
remove it.) And I see no reason to support it.
* In the desugarer, I desguar empty `HsCase` to a call to `error`. (The
simplifier already does this if it can figure out that a case is empty;
see `Simplify.rebuildCase`.)
So now Neil's TH example works instead of crashing. The parser prevents
you doing this in source code, so I have not added a flag.
To go the full distance we still need:
* Parser to accept empty case expressions (currently rejected by parser)
* -X flag to control this language extension
* Test somewhere (in renamer) to check that empty case only happens when
flag is on.
* User manual docs
* Regresssion tests in test suite.
All easy but tiresome. If you care about this, send a patch! I've done
the slightly-tricky bits. So I'll leave this bug open at low priority,
milestone bottom.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2431#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs