@@ -27,6 +27,8 @@ import Language.PureScript.Environment
2727import Language.PureScript.Errors
2828import Language.PureScript.CodeGen.Common (identToJs)
2929
30+import qualified Language.PureScript.Constants as C
31+
3032import Control.Applicative
3133import Control.Monad.State
3234import Control.Arrow (first, second)
@@ -164,9 +166,12 @@ typeInstanceDictionaryDeclaration name mn deps className tys decls = do
164166 -- The dictionary itself is an object literal, but for reasons related to recursion, the dictionary
165167 -- must be guarded by at least one function abstraction. For that reason, if the dictionary has no
166168 -- dependencies, we introduce an unnamed function parameter.
167− let dictTy = TypeApp tyObject (rowFromList (map (first identToProperty) memberTypes, RCons "__superclasses" (TypeApp tyArray unit) REmpty))
169+ let (memberTypes', memberNames') =
170+ if null implies
171+ then (memberTypes, memberNames)
172+ else ((Ident C.__superclasses, TypeApp tyArray unit) : memberTypes, (C.__superclasses, superclasses) : memberNames)
173+ dictTy = TypeApp tyObject (rowFromList (map (first identToProperty) memberTypes', REmpty))
168174 constrainedTy = quantify (if null deps then function unit dictTy else ConstrainedType deps dictTy)
169− memberNames' = ("__superclasses", superclasses) : memberNames
170175 dict = if null deps then Abs (Left (Ident "_")) (ObjectLiteral memberNames') else ObjectLiteral memberNames'
171176 return $ ValueDeclaration name TypeInstanceDictionaryValue [] Nothing (TypedValue True dict constrainedTy)
172177 where