[GHC] #12441: Conflicting definitions error does not print explicit quantifiers when necessary
GHC
ghc-devs at haskell.org
Mon Aug 29 22:00:20 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 (Type | Version: 8.0.1
checker) |
Resolution: | Keywords: newcomers
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by bgamari):
* keywords: => newcomers
* failure: None/Unknown => Incorrect warning at compile-time
@@ -1,1 +1,1 @@
- {{{
+ {{{#!hs
@@ -6,0 +6,1 @@
+
@@ -9,0 +10,1 @@
+
New description:
{{{#!hs
-- 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.
--
Comment:
I think this would be a reasonable thing for a newcomer to knock off. Just
check whether the two types are equivalent up to quantifiers and render
them with quantifiers if so.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12441#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list