Skip to content

Associated type defaults + MultiParamTypeClasses error

If I try this with GHC HEAD as of yesterday:

{-# LANGUAGE TypeFamilies, MultiParamTypeClasses #-}

class Foo a b where
    type X a
    type X a = b
    type Y b
    type Y b = a

I get this error:

test2.hs:7:5:
    Type indexes must match class instance head
    Found `b' but expected `a'
    In the type synonym instance declaration for `Y'
    In the class declaration for `Foo'

Notably, it doesn't complain about type X a = b, only type Y b = a. Unless I'm doing something dumb, it should probably work both ways.

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