Skip to content

-ddump-minimal-imports creates incorrect imports for associated types

If you have a module URL.hs:

{-# LANGUAGE TypeFamilies #-}

module URL (ToURL(toURL, nullURL, errorURL), URLT) where

class ToURL a where
    type URLT a
    toURL :: a -> URLT a
    nullURL :: a
    errorURL :: a -> URLT a

And a module that uses it Tmp.hs:

{-# LANGUAGE FlexibleContexts #-}
module Tmp ( clean ) where

import Data.Char (isAlphaNum)
import Data.List (dropWhile)
import URL

clean :: (ToURL url, Show (URLT url)) => url -> String
clean = filter isAlphaNum . show . toURL

when you run ghc -ddump-minimal-imports Tmp.hs the resulting Tmp.imports will contain the line

import URL ( ToURL(URLT, toURL) )

but it should contain

import URL ( ToURL(toURL), URLT )

This affects both associated type and associated type synonym declarations.

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