Skip to content

methods and associated types treated differently wrt. qualification

Say I have the following module:

{-# LANGUAGE TypeFamilies #-}
module M where

    class C a where

        type T a :: *

        m :: a

Now I use this module in another module via a qualified import:

{-# LANGUAGE TypeFamilies #-}
module U where

    import qualified M

    instance M.C Integer where

        type M.T Integer = Integer

        m = 0

Note that in the instance declaration, the associated type T is qualified, while the method m is not. Removing the qualification of T is not accepted by GHC, but neither is adding a qualification to m. I think this inconsistency is unfortunate, so that it might be good to remove it.

Trac metadata
Trac field Value
Version 7.0.4
Type FeatureRequest
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