[GHC] #13021: Inaccessible RHS warning is confusing for users

GHC ghc-devs at haskell.org
Wed Dec 21 17:28:05 UTC 2016


#13021: Inaccessible RHS warning is confusing for users
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
                                     |  PatternMatchWarnings
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 My confusion here is at a very basic level. `_` is a pattern such that any
 set of pattern matches which includes `_` is total. Yet in a function like
 {{{
 f :: Maybe a -> Int
 f Nothing = 0
 f _ = 1
 }}}
 the first equation is not redundant in a practical sense, even though the
 pattern match would still be total without it. There's more to life than
 totality of pattern matches.

 I thought that a `{-# COMPLETE p1, ..., pn #-}` pragma was just supposed
 to mean that a function that matches all of the `pi` should be regarded as
 total. It doesn't make any sense to me for the compiler to use this
 knowledge plus the definitions of the `pi` to make any conclusions about
 whether other values are possible or not.

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


More information about the ghc-tickets mailing list