Skip to content

Confusing warning message with -Wduplicate-exports

Consider this program:

module Internal where

data Foo = Foo

and

{-# OPTIONS_GHC -Wduplicate-exports #-}
module External
    ( module Internal
    , Foo
    ) where

import Internal (Foo)

Compiler says this:

External.hs:4:7: warning: [-Wduplicate-exports]
    ‘Foo’ is exported by ‘Foo’ and ‘module Internal’
  |
4 |     , Foo
  |       ^^^

The first part of message reads a bit strange. Wouldn't it be better to have something like "‘Foo’ is already exported by ‘module Internal’?

Ideally we would also suggest to delete the (Foo) in import Internal (Foo) in External.hs

ghc 9.2.4

Edited by Alex D
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information