[GHC] #10076: Don't suppress warnings in the presence of errors

GHC ghc-devs at haskell.org
Tue Feb 10 10:30:31 UTC 2015


#10076: Don't suppress warnings in the presence of errors
-------------------------------------+-------------------------------------
              Reporter:  jstolarek   |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  normal      |           Version:  7.11
             Component:  Compiler    |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  Incorrect
          Architecture:              |  warning at compile-time
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Consider this fragment of code (uses injective type families, not yet
 merged into HEAD):

 {{{#!hs
 type family Bar a = r | r -> a where
     Bar Int  = Bool
     Bar Bool = Int
     Bar Bool = Char

 bar :: Bar a -> Bar a
 bar x = x

 barapp :: Char
 barapp = bar 'c'
 }}}

 GHC rejects this with an error:

 {{{
 Couldn't match expected type ‘Bar a0’ with actual type ‘Char’
 The type variable ‘a0’ is ambiguous
 In the first argument of ‘bar’, namely ‘'c'’
 In the expression: bar 'c'
 In an equation for ‘barapp’: barapp = bar 'c'
 }}}

 The reason why this is rejected is that the last type family equation is
 not reachable. GHC warns about that if I comment out `barapp`:

 {{{
 Dropping overlapped type family instance equation:
   Bar Bool = Char
 }}}

 I believe that with that warning source of the error would be easier to
 find. So I propose that by default GHC does not suppress warnings in the
 presence of errors.

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


More information about the ghc-tickets mailing list