@@ -53,7 +53,7 @@ import Util.Pretty(pretty, text)
5353data MArgTy = IA | EA | CA deriving Show
5454
5555elabClass :: ElabInfo -> SyntaxInfo -> Docstring (Either Err PTerm) ->
56− FC -> [PTerm] ->
56+ FC -> [(Name, PTerm)] ->
5757 Name -> [(Name, PTerm)] -> [(Name, Docstring (Either Err PTerm))] -> [PDecl] -> Idris ()
5858elabClass info syn_in doc fc constraints tn ps pDocs ds
5959 = do let cn = SN (InstanceCtorN tn) -- sUN ("instance" ++ show tn) -- MN 0 ("instance" ++ show tn)
@@ -115,7 +115,7 @@ elabClass info syn_in doc fc constraints tn ps pDocs ds
115115 $ tfail (At fc (Msg $ "Default superclass instances can't have constraints."))
116116 i <- getIState
117117 let t = PApp fc (PRef fc n) (map pexp ps)
118− let isConstrained = any (== t) constraints
118+ let isConstrained = any (== t) (map snd constraints)
119119 when (not isConstrained) . tclift
120120 $ tfail (At fc (Msg $ "Default instances must be for a superclass constraint on the containing class."))
121121 return ()
@@ -124,8 +124,8 @@ elabClass info syn_in doc fc constraints tn ps pDocs ds
124124 impbind [] x = x
125125 impbind ((n, ty): ns) x = PPi impl n ty (impbind ns x)
126126
127− conbind :: [PTerm] -> PTerm -> PTerm
128− conbind (ty : ns) x = PPi constraint (sMN 0 "class") ty (conbind ns x)
127+ conbind :: [(Name, PTerm)] -> PTerm -> PTerm
128+ conbind ((c, ty) : ns) x = PPi constraint c ty (conbind ns x)
129129 conbind [] x = x
130130
131131 getMName (PTy _ _ _ _ _ n _) = nsroot n
@@ -160,15 +160,15 @@ elabClass info syn_in doc fc constraints tn ps pDocs ds
160160 clause _ = False
161161
162162 -- Generate a function for chasing a dictionary constraint
163− cfun :: Name -> PTerm -> SyntaxInfo -> [a] -> PTerm -> Idris [PDecl' PTerm]
164− cfun cn c syn all con
163+ cfun :: Name -> PTerm -> SyntaxInfo -> [a] -> (Name, PTerm) -> Idris [PDecl' PTerm]
164+ cfun cn c syn all (cnm, con)
165165 = do let cfn = sUN ('@':'@':show cn ++ "#" ++ show con)
166166 -- SN (ParentN cn (show con))
167167 let mnames = take (length all) $ map (\x -> sMN x "meth") [0..]
168168 let capp = PApp fc (PRef fc cn) (map (pexp . PRef fc) mnames)
169169 let lhs = PApp fc (PRef fc cfn) [pconst capp]
170170 let rhs = PResolveTC (fileFC "HACK")
171− let ty = PPi constraint (sMN 0 "pc") c con
171+ let ty = PPi constraint cnm c con
172172 iLOG (showTmImpls ty)
173173 iLOG (showTmImpls lhs ++ " = " ++ showTmImpls rhs)
174174 i <- getIState