[GHC] #12441: Conflicting definitions error does not print explicit quantifiers when necessary

GHC ghc-devs at haskell.org
Tue Jul 26 22:21:50 UTC 2016


#12441: Conflicting definitions error does not print explicit quantifiers when
necessary
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
  (Type checker)                     |
           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:
-------------------------------------+-------------------------------------
 {{{
 -- Y.hs-boot
 {-# LANGUAGE ScopedTypeVariables #-}
 module Y where
 f :: forall a b. (a, b)
 -- YY.hs
 module YY where
 import {-# SOURCE #-} Y
 -- Y.hs
 {-# LANGUAGE ScopedTypeVariables #-}
 module Y where
 import YY
 f :: forall b a. (a, b)
 f = undefined
 }}}

 I get the following unhelpful error:

 {{{
 ezyang at sabre:~$ ghc-8.0 --make Y.hs -fforce-recomp
 [1 of 3] Compiling Y[boot]          ( Y.hs-boot, Y.o-boot )
 [2 of 3] Compiling YY               ( YY.hs, YY.o )
 [3 of 3] Compiling Y                ( Y.hs, Y.o )

 Y.hs-boot:3:1: error:
     Identifier ‘f’ has conflicting definitions in the module
     and its hs-boot file
     Main module: f :: (a, b)
     Boot file:   f :: (a, b)
     The two types are different
 }}}

 Yes this example is purposely shooting itself in the foot, but in the wild
 I encountered an un-annotated type which inferred a different quantifier
 ordering than what I expected, and I subsequently spent a while puzzling
 over the error message. `-fprint-explicit-foralls` is a sufficient
 workaround.

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


More information about the ghc-tickets mailing list