Missing warning about redundant import for a class instance
I have the following module
module RedundantImport where -- this import is redundant, but GHC does not spot it import qualified Foreign.Storable as St import Foreign.Storable (Storable, sizeOf, alignment, peek, poke, ) import Foreign.Ptr (castPtr, ) newtype T a = Cons a instance Storable a => Storable (T a) where sizeOf (Cons a) = sizeOf a alignment (Cons a) = alignment a peek = fmap Cons . peek . castPtr poke p (Cons a) = poke (castPtr p) a
If loaded into GHCi with -Wall option, then GHCi does not give a warning, although the first import is redundant. It might have to do with the way how GHC accepts unqualified method names in instance implementations although the concerned method names are only imported in a qualified way.