Currently we assign a mirror $wf:ATC to an associated type ATC of class say C.
or
class C a where
type ATC a
op :: ...
gets elaborated to
class C a where
type ATC a
type $wf:ATC a :: Constraint
op :: ...
Will it be more appropriate to add the class constraint as the wellformedness mirror?
Possible problem may be that the associated data type has fewer type variables than the class variables potentially, giving rise to unambiguous types post elaboration.
Motivation:
There are cases where a data type references an associated type.
data IsNode a => Graph a = Graph { graphMap :: (Map (Key a) a) }
class Ord (Key a) => IsNode a where
type Key a :: *
nodeKey :: a -> Key a
nodeNeighbors :: a -> [Key a]
Currently we assign a mirror
$wf:ATCto an associated typeATCof class sayC.or
gets elaborated to
Will it be more appropriate to add the class constraint as the wellformedness mirror?
Possible problem may be that the associated data type has fewer type variables than the class variables potentially, giving rise to unambiguous types post elaboration.
Motivation:
There are cases where a data type references an associated type.