Skip to content

GHC should warn about redundant import of a type name also if one of its record selectors is imported

Sorry, I have another corner case for a redundant import warning:

module Main where

import Control.Monad.Trans.Writer (WriterT, runWriterT)

main :: IO ()
main = undefined runWriterT

This module will not provoke a warning, although the import of WriterT can be omitted. I assume this is because runWriterT is a record selector of WriterT and could (or should?) be imported as:

import Control.Monad.Trans.Writer (WriterT(runWriterT))

Since I used runWriterT like a regular function I did not care about its record selector feature.

Trac metadata
Trac field Value
Version 7.6.3
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