Skip to content

Warning: The import of `B.foo' from module `A' is redundant

Let's consider such A.hs:

module A (C(foo)) where

class C a where
    foo :: a
    foo = bar
    bar :: a
    bar = foo

and B.hs:

module B (Foo(..)) where

import qualified A as B (C(foo))
-- import qualified A as B (C) -- ? erros too

data Foo = Foo Int deriving Show


instance B.C Foo where
    foo = Foo 4

Trying to build:

$ ghc --make -Wall -Werror B
[1 of 2] Compiling A                ( A.hs, A.o )
[2 of 2] Compiling B                ( B.hs, B.o )

B.hs:3:0:
    Warning: The import of `B.foo' from module `A' is redundant

<no location info>: 
Failing due to -Werror.

If I will remove foo somehow - I will get another error. At least message looks misleading, and warning seems to be false positive.

Might be related ot #1074 (closed)

Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information