[GHC] #8853: Alarming looking warning about non-exhaustive pattern

GHC ghc-devs at haskell.org
Thu Mar 6 21:52:04 UTC 2014


#8853: Alarming looking warning about non-exhaustive pattern
-------------------------------------------------+-------------------------
        Reporter:  MikolajKonarski               |            Owner:
            Type:  bug                           |           Status:  new
        Priority:  normal                        |        Milestone:
       Component:  Compiler                      |          Version:
      Resolution:                                |  7.8.1-rc2
Operating System:  Linux                         |         Keywords:
 Type of failure:  Incorrect warning at          |     Architecture:
  compile-time                                   |  x86_64 (amd64)
       Test Case:                                |       Difficulty:
        Blocking:                                |  Unknown
                                                 |       Blocked By:
                                                 |  Related Tickets:
-------------------------------------------------+-------------------------
Description changed by ezyang:

Old description:

> The attached code produces this alarming warning:
>
> ~/waste$ ghc --version
> The Glorious Glasgow Haskell Compilation System, version 7.8.0.20140228
> ~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp
> [1 of 1] Compiling Main             ( AlarmingPattern.hs,
> AlarmingPattern.o )
>
> AlarmingPattern.hs:6:7: Warning:
>     Pattern match(es) are non-exhaustive
>     In an equation for ‘takeFromInv’:
>         Patterns not matched:
>             (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#]
> Linking AlarmingPattern ...
> ~/waste$ ./AlarmingPattern
> AlarmingPattern: AlarmingPattern.hs:(6,7)-(7,26): Non-exhaustive patterns
> in function takeFromInv

New description:

 The attached code produces this alarming warning:

 {{{
 ~/waste$ ghc --version
 The Glorious Glasgow Haskell Compilation System, version 7.8.0.20140228
 ~/waste$ ghc -Wall --make AlarmingPattern.hs -fforce-recomp
 [1 of 1] Compiling Main             ( AlarmingPattern.hs,
 AlarmingPattern.o )

 AlarmingPattern.hs:6:7: Warning:
     Pattern match(es) are non-exhaustive
     In an equation for ‘takeFromInv’:
         Patterns not matched:
             (GHC.Types.I# _) (GHC.Types.I# (#x)) with #x `notElem` [0#]
 Linking AlarmingPattern ...
 ~/waste$ ./AlarmingPattern
 AlarmingPattern: AlarmingPattern.hs:(6,7)-(7,26): Non-exhaustive patterns
 in function takeFromInv
 }}}

--

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


More information about the ghc-tickets mailing list