@@ -281,8 +281,9 @@ elabClause info fc (PWith fname lhs_in withs wval_in withblock)
281281 updateLHS n wname mvars ns tm w = fail $ "Not implemented " ++ show tm
282282
283283elabClass :: ElabInfo -> SyntaxInfo ->
284− FC -> Name -> [(Name, PTerm)] -> [PDecl] -> Idris ()
285−elabClass info syn fc tn ps ds
284+ FC -> [PTerm] ->
285+ Name -> [(Name, PTerm)] -> [PDecl] -> Idris ()
286+elabClass info syn fc constraints tn ps ds
286287 = do let cn = UN ["instance" ++ show tn] -- MN 0 ("instance" ++ show tn)
287288 let tty = pibind ps PSet
288289 let constraint = PApp fc (PRef fc tn)
@@ -290,7 +291,7 @@ elabClass info syn fc tn ps ds
290291 -- build data declaration
291292 ims <- mapM tdecl ds
292293 let (methods, imethods) = unzip ims
293− let cty = impbind ps $ pibind methods constraint
294+ let cty = impbind ps $ conbind constraints $ pibind methods constraint
294295 let cons = [(cn, cty, fc)]
295296 let ddecl = PData syn fc (PDatadecl tn tty cons)
296297 elabDecl info ddecl
@@ -304,6 +305,8 @@ elabClass info syn fc tn ps ds
304305 pibind ((n, ty): ns) x = PPi expl n ty (pibind ns x)
305306 impbind [] x = x
306307 impbind ((n, ty): ns) x = PPi impl n ty (impbind ns x)
308+ conbind (ty : ns) x = PPi constraint (MN 0 "c") ty (conbind ns x)
309+ conbind [] x = x
307310
308311 tdecl (PTy syn _ n t) = do t' <- implicit syn n t
309312 return ( (n, (toExp (map fst ps) Exp t')),
@@ -400,8 +403,8 @@ elabDecl' info (PParams f ns ps) = mapM_ (elabDecl' pinfo) ps
400403 newb = addAlist dsParams (inblock info) in
401404 info { params = newps,
402405 inblock = newb }
403−elabDecl' info (PClass s f n ps ds) = do iLOG $ "Elaborating class " ++ show n
404− elabClass info s f n ps ds
406+elabDecl' info (PClass s f cs n ps ds) = do iLOG $ "Elaborating class " ++ show n
407+ elabClass info s f cs n ps ds
405408elabDecl' info (PInstance s f n t ds) = do iLOG $ "Elaborating instance " ++ show n
406409 elabInstance info s f n t ds
407410