[GHC] #10180: Lint check: Empty alternatives imply bottoming scrutinee

GHC ghc-devs at haskell.org
Mon Mar 23 08:59:07 UTC 2015


#10180: Lint check: Empty alternatives imply bottoming scrutinee
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                   Owner:  nomeata
            Type:  task              |                  Status:  infoneeded
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.11
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by simonpj):

 > Simon, what would you prefer: Should `exprIsBottom e` hold for all `e`
 where the type is a data type with no constructors, or should the lint
 check take that into account?

 Very interesting.
  * What program gives rise to `case (x::Void) of {}`?

  * Yes, I think there is a case for making `exprIsBottom` hold for data
 types with no constructors; after all, such an expression is bound to
 diverge.

  * A slightly less pervasive change would to to say that an empty `case`
 is ok on a data type that has an empty set of constructors.  Less
 pervasive in the sense that it affects this Lint check only, whereas the
 `exprIsBottom` fix would have broader implications: good ones, I think,
 but also rare.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10180#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list