IaFP / ghc

A slightly more Glorious Haskell Compiler
Other
2 stars 0 forks source link

Associated TFs #15

Closed ahubers closed 2 years ago

ahubers commented 2 years ago

Adds support for Associated Type Families, e.g,

class Collection a where
  type family Elem a
  e :: a
  cons :: Elem a -> a -> a

instance Collection [a] where
  type instance Elem [a] = a
  ...

foobar :: Elem a -> a
foobar = undefined

will generate WF_Elem type family with WF_Elem [a] = () constraint instance. foobar will be elaborated to have WF_Elem a constraint.

fxdpntthm commented 2 years ago

you should be generating the wf type fam tycon in IfaceToCore because thats where all the AT magic is performed.

ahubers commented 2 years ago

Closing -- majority of work here has made its way into main on its own