[GHC] #4921: report ambiguous type variables more consistently

GHC ghc-devs at haskell.org
Fri Nov 28 19:33:34 UTC 2014


#4921: report ambiguous type variables more consistently
-------------------------------------+-------------------------------------
              Reporter:  Saizan      |            Owner:
                  Type:  feature     |           Status:  new
  request                            |        Milestone:  7.10.1
              Priority:  low         |          Version:  7.0.1
             Component:  Compiler    |         Keywords:
  (Type checker)                     |     Architecture:  Unknown/Multiple
            Resolution:              |       Difficulty:  Unknown
      Operating System:              |       Blocked By:
  Unknown/Multiple                   |  Related Tickets:
       Type of failure:              |
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by thomie):

 * difficulty:   => Unknown


Comment:

 This seems fixed, pending a regression test. The error messages for `x`
 and `y` are no longer completely different.

 Ghc shows for `y`, since version 7.6.3: `The type variable ‘b0’ is
 ambiguous`. And since version 7.8.3 it doesn't show anymore: `Possible
 fix: add an instance declaration for (C Int b)`.

 Here is the full error message with HEAD:
 {{{
 $ ghc-7.9.20141125 test.hs
 [1 of 1] Compiling Amb              ( test.hs, test.o )

 test.hs:10:9:
     No instance for (C a0 b1) arising from a use of ‘f’
     The type variables ‘a0’, ‘b1’ are ambiguous
     Relevant bindings include x :: a0 (bound at test.hs:10:1)
     Note: there is a potential instance available:
       instance C Int Char -- Defined at test.hs:7:10
     In the first argument of ‘fst’, namely ‘f’
     In the expression: fst f
     In an equation for ‘x’: x = fst f

 test.hs:11:9:
     No instance for (C Int b0) arising from a use of ‘f’
     The type variable ‘b0’ is ambiguous
     Note: there is a potential instance available:
       instance C Int Char -- Defined at test.hs:7:10
     In the first argument of ‘fst’, namely ‘f’
     In the expression: fst f :: Int
     In an equation for ‘y’: y = fst f :: Int
 }}}

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


More information about the ghc-tickets mailing list