@@ -107,7 +107,7 @@ mkSpineFunction mn (DataDeclaration _ _ _ args) = lamCase "$x" <$> mapM mkCtorCl
107 return $ CaseAlternative [ConstructorBinder (Qualified (Just mn) ctorName) (map VarBinder idents)] (Right (caseResult idents))
107 return $ CaseAlternative [ConstructorBinder (Qualified (Just mn) ctorName) (map VarBinder idents)] (Right (caseResult idents))
109 caseResult idents =
109 caseResult idents =
110− App (prodConstructor (StringLiteral . runProperName $ ctorName))
110+ App (prodConstructor (StringLiteral . showQualified runProperName $ Qualified (Just mn) ctorName))
111 . ArrayLiteral
111 . ArrayLiteral
112 $ zipWith toSpineFun (map (Var . Qualified Nothing) idents) tys
112 $ zipWith toSpineFun (map (Var . Qualified Nothing) idents) tys
@@ -121,10 +121,12 @@ mkSpineFunction mn (PositionedDeclaration _ _ d) = mkSpineFunction mn d
121mkSpineFunction _ _ = internalError "mkSpineFunction: expected DataDeclaration"
121mkSpineFunction _ _ = internalError "mkSpineFunction: expected DataDeclaration"
123mkSignatureFunction :: ModuleName -> Declaration -> [Type] -> Expr
123mkSignatureFunction :: ModuleName -> Declaration -> [Type] -> Expr
124−mkSignatureFunction _ (DataDeclaration _ _ tyArgs args) classArgs = lamNull . mkSigProd $ map mkProdClause args
124+mkSignatureFunction mn (DataDeclaration _ name tyArgs args) classArgs = lamNull . mkSigProd $ map mkProdClause args
126 mkSigProd :: [Expr] -> Expr
126 mkSigProd :: [Expr] -> Expr
127− mkSigProd = App (Constructor (Qualified (Just dataGeneric) (ProperName "SigProd"))) . ArrayLiteral
127+ mkSigProd = App (App (Constructor (Qualified (Just dataGeneric) (ProperName "SigProd")))
128+ (StringLiteral (showQualified runProperName (Qualified (Just mn) name)))
129 mkSigRec :: [Expr] -> Expr
131 mkSigRec :: [Expr] -> Expr
130 mkSigRec = App (Constructor (Qualified (Just dataGeneric) (ProperName "SigRecord"))) . ArrayLiteral
132 mkSigRec = App (Constructor (Qualified (Just dataGeneric) (ProperName "SigRecord"))) . ArrayLiteral
@@ -133,7 +135,7 @@ mkSignatureFunction _ (DataDeclaration _ _ tyArgs args) classArgs = lamNull . mk
133 proxy = TypeApp (TypeConstructor (Qualified (Just dataGeneric) (ProperName "Proxy")))
135 proxy = TypeApp (TypeConstructor (Qualified (Just dataGeneric) (ProperName "Proxy")))
135 mkProdClause :: (ProperName, [Type]) -> Expr
137 mkProdClause :: (ProperName, [Type]) -> Expr
136− mkProdClause (ctorName, tys) = ObjectLiteral [ ("sigConstructor", StringLiteral (runProperName ctorName))
138+ mkProdClause (ctorName, tys) = ObjectLiteral [ ("sigConstructor", StringLiteral (showQualified runProperName (Qualified (Just mn) ctorName)))
137 , ("sigValues", ArrayLiteral . map (mkProductSignature . instantiate) $ tys)
139 , ("sigValues", ArrayLiteral . map (mkProductSignature . instantiate) $ tys)
@@ -168,7 +170,7 @@ mkFromSpineFunction mn (DataDeclaration _ _ _ args) = lamCase "$x" <$> (addCatch
168 mkAlternative :: (ProperName, [Type]) -> m CaseAlternative
170 mkAlternative :: (ProperName, [Type]) -> m CaseAlternative
169 mkAlternative (ctorName, tys) = do
171 mkAlternative (ctorName, tys) = do
170 idents <- replicateM (length tys) (fmap Ident freshName)
172 idents <- replicateM (length tys) (fmap Ident freshName)
171− return $ CaseAlternative [ prodBinder [ StringBinder (runProperName ctorName), ArrayBinder (map VarBinder idents)]]
173+ return $ CaseAlternative [ prodBinder [ StringBinder (showQualified runProperName (Qualified (Just mn) ctorName)), ArrayBinder (map VarBinder idents)]]
173 $ liftApplicative (mkJust $ Constructor (Qualified (Just mn) ctorName))
175 $ liftApplicative (mkJust $ Constructor (Qualified (Just mn) ctorName))
174 (zipWith fromSpineFun (map (Var . Qualified Nothing) idents) tys)
176 (zipWith fromSpineFun (map (Var . Qualified Nothing) idents) tys)