Skip to content

Default type family instance in class can not refer to all class parameters

Motivation

import Data.Kind (Type)

-- You'd also have `RelF a ~ b` as a constraint, albeit it's not relevant here.
class Rel (a :: Type) (b :: Type) | a -> b where
  type RelF a :: Type
  type RelF a = b

This should work, but it complains that b on the last line is out of scope.

Example.hs:5:17: error: Not in scope: type variable ‘b’
  |
5 |   type RelF a = b

Proposal

This should ideally work. I'm willing to fix this myself, and would appreciate some pointers as to which file/directory in GHC this pertains to.

Edited by Las Safin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information