#2431: allow empty case analysis
---------------------------------+------------------------------------------
 Reporter:  RalfHinze            |          Owner:         
     Type:  feature request      |         Status:  new    
 Priority:  normal               |      Milestone:         
Component:  Compiler             |        Version:  6.8.3  
 Severity:  minor                |     Resolution:         
 Keywords:  empty case analysis  |     Difficulty:  Unknown
 Testcase:                       |   Architecture:  Unknown
       Os:  Unknown              |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * difficulty:  => Unknown

Old description:

> Using -XEmptyDataDecls I can declare an (almost) empty data type.
>   data Void
> However, I can't use an empty case to discriminate values of the
> empty type.
>
> This does not work:
>   get :: Void -> a
> Only the type signature, but no body. [This would be useful also
> in other circumstances.]
>   get :: Void -> a
>   get v = case v of { }
> An empty case in the body.

New description:

 Using -XEmptyDataDecls I can declare an (almost) empty data type.
 {{{
   data Void
 }}}
 However, I can't use an empty case to discriminate values of the
 empty type.

 This does not work:
 {{{
   get :: Void -> a
 }}}
 Only the type signature, but no body. [This would be useful also
 in other circumstances.]
 {{{
   get :: Void -> a
   get v = case v of { }
 }}}
 An empty case in the body.

Comment:

 Why is this useful?  The only value of type `Void` is bottom.

 Simon

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2431#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to