Duplicate Exports [GHC-47854]

Flag: -Wduplicate-exports
Enabled by default

An export list of a module mentions the same identifier twice.

Examples

Duplicate export

The module Example mentions the symbol answer twice in its export list.

To avoid the warning, simply remove the duplicated mention.

Error Message

Main.hs:3:25: warning: [-Wduplicate-exports] [GHC-47854]
    ‘answer’ is exported by ‘answer’ and ‘answer’
  |
3 | module Example (answer, answer) where
  |                         ^^^^^^
Main.hs
Before
module Example (answer, answer) where

answer :: Int
answer = 42
After
module Example (answer) where

answer :: Int
answer = 42
Duplicate field export

The module Example exports the symbol answer twice. In addition to the explicit entry in the export list it’s also exported by Example(..).

To avoid the warning, remove one of the duplicated mention.

Error Message

Main.hs:1:25: warning: [-Wduplicate-exports] [GHC-47854]
    ‘answer’ is exported by ‘Example(..)’ and ‘answer’
  |
1 | module Example (answer, Example(..)) where
  |                        ^^^^^^
Main.hs
Before
module Example (answer, Example(..)) where

data Example = Example { answer :: Int }
After
module Example (Example) where

data Example = Example { answer :: Int }