@@ -70,6 +70,14 @@ desugarModule _ = error "Exports should have been elaborated in name desugaring"
70-- instance fooArray :: (Foo a) => Foo [a] where
70-- instance fooArray :: (Foo a) => Foo [a] where
71-- foo = map foo
71-- foo = map foo
75+-- class (Foo a) <= Sub a where
78+-- instance subString :: Sub String where
75-- type Foo a = { foo :: a -> a }
83-- type Foo a = { foo :: a -> a }
@@ -84,6 +92,19 @@ desugarModule _ = error "Exports should have been elaborated in name desugaring"
84-- fooArray :: forall a. (Foo a) => Foo [a]
92-- fooArray :: forall a. (Foo a) => Foo [a]
85-- fooArray = { foo: map foo }
93-- fooArray = { foo: map foo }
99+-- subString :: {} -> { __superclasses :: [{}], sub :: String }
101+-- __superclasses: [\<dictionary placeholder to be inserted during type checking\>]
105+-- Here, the __superclasses property is not typechecked (it is not even well-typed, since its
106+-- entries might be dictionaries of different types).
87desugarDecl :: ModuleName -> Declaration -> Desugar (Maybe DeclarationRef, [Declaration])
108desugarDecl :: ModuleName -> Declaration -> Desugar (Maybe DeclarationRef, [Declaration])
88desugarDecl mn d@(TypeClassDeclaration name args _ members) = do
109desugarDecl mn d@(TypeClassDeclaration name args _ members) = do
89 modify (M.insert (mn, name) d)
110 modify (M.insert (mn, name) d)