[GHC] #15438: Misleading error message for higher rank type

GHC ghc-devs at haskell.org
Wed Jul 25 10:15:52 UTC 2018


#15438: Misleading error message for higher rank type
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider
 {{{
 foo :: (forall a b. C a b => b -> b) -> Int
 foo = error "urk"
 }}}
 With GHC (for ages, incl 8.6) we get
 {{{
     • Could not deduce (C a0 b)
       from the context: C a b
         bound by the type signature for:
           foo :: forall a b. C a b => b -> b      <======= Not true!
         at Foo.hs:7:8-43
       The type variable ‘a0’ is ambiguous
     • In the ambiguity check for ‘foo’
       To defer the ambiguity check to use sites, enable
 AllowAmbiguousTypes
       In the type signature: foo :: (forall a b. C a b => b -> b) -> Int
 }}}
 But `foo`'s type signature is NOT `foo :: forall a b. C a b => b -> b`!!

 Let's fix this.

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


More information about the ghc-tickets mailing list