Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,274
    • Issues 4,274
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 412
    • Merge Requests 412
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16856

Closed
Open
Opened Jun 22, 2019 by fosskers@trac-fosskers

Qualified Prelude and -Wdodgy-exports

Summary

When reexporting symbols from Prelude from some module A, then further reexporting A from another module which also imports the Prelude qualified, -Wdodgy-exports can be triggered. This pattern of reexporting shows up often in "alternate Preludes".

Steps to reproduce

Produce a module Fun:

module Fun
  ( Data.Bool.Bool(..)  -- A symbol also present in Prelude
  ) where

import qualified Data.Bool

now produce a module Lib:

module Lib
  ( module Fun  -- reexports Bool
  ) where

import qualified Fun
-- import qualified Prelude

Compile with -Wall, and see no warnings. Now uncomment the qualified import of Prelude and see the following:

/home/colin/code/haskell/dodgy-bug/src/Lib.hs:2:5-14: warning: [-Wdodgy-exports]
    The export item ‘module Fun’ exports nothing
  |
2 |   ( module Fun
  |     ^^^^^^^^^^
/home/colin/code/haskell/dodgy-bug/src/Lib.hs:5:1-20: warning: [-Wunused-imports]
    The qualified import of ‘Fun’ is redundant
  |
5 | import qualified Fun
  | ^^^^^^^^^^^^^^^^^^^^
/home/colin/code/haskell/dodgy-bug/src/Lib.hs:6:1-24: warning: [-Wunused-imports]
    The qualified import of ‘Prelude’ is redundant
  |
6 | import qualified Prelude
  | ^^^^^^^^^^^^^^^^^^^^^^^^

Now remove the qualified section of the Prelude import, and see no warnings. The presence/absence of NoImplicitPrelude seems to have no effect here.

Expected behavior

I'd expect no warnings in any of the three cases.

Environment

  • GHC version used: 8.6.5

Optional:

  • Operating System: Arch Linux
  • System Architecture: x86_64
Assignee
Assign to
8.8.2
Milestone
8.8.2 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#16856