@@ -555,21 +555,21 @@ elabClass info syn fc constraints tn ps ds
555 conbind (ty : ns) x = PPi constraint (MN 0 "c") ty (conbind ns x)
555 conbind (ty : ns) x = PPi constraint (MN 0 "c") ty (conbind ns x)
556 conbind [] x = x
556 conbind [] x = x
558− tdecl (PTy syn _ _ n t) = do t' <- implicit syn n t
558+ tdecl (PTy syn _ o n t) = do t' <- implicit syn n t
559 return ( (n, (toExp (map fst ps) Exp t')),
559 return ( (n, (toExp (map fst ps) Exp t')),
560− (n, (toExp (map fst ps) Imp t')),
560+ (n, (o, (toExp (map fst ps) Imp t'))),
561− (n, (syn, t) ) )
561+ (n, (syn, o, t) ) )
562 tdecl _ = fail "Not allowed in a class declaration"
562 tdecl _ = fail "Not allowed in a class declaration"
564 -- Create default definitions
564 -- Create default definitions
565 defdecl mtys c d@(PClauses fc opts n cs) =
565 defdecl mtys c d@(PClauses fc opts n cs) =
566 case lookup n mtys of
566 case lookup n mtys of
567− Just (syn, ty) -> do let ty' = insertConstraint c ty
567+ Just (syn, o, ty) -> do let ty' = insertConstraint c ty
568− let ds = map (decorateid defaultdec)
568+ let ds = map (decorateid defaultdec)
569− [PTy syn fc [] n ty',
569+ [PTy syn fc [] n ty',
570− PClauses fc (TCGen:opts) n cs]
570+ PClauses fc (TCGen:o ++ opts) n cs]
571− iLOG (show ds)
571+ iLOG (show ds)
572− return (n, (defaultdec n, ds))
572+ return (n, (defaultdec n, ds))
573 _ -> fail $ show n ++ " is not a method"
573 _ -> fail $ show n ++ " is not a method"
574 defdecl _ _ _ = fail "Can't happen (defdecl)"
574 defdecl _ _ _ = fail "Can't happen (defdecl)"
@@ -593,7 +593,7 @@ elabClass info syn fc constraints tn ps ds
593 return [PTy syn fc [] cfn ty,
593 return [PTy syn fc [] cfn ty,
594 PClauses fc [Inlinable,TCGen] cfn [PClause cfn lhs [] rhs []]]
594 PClauses fc [Inlinable,TCGen] cfn [PClause cfn lhs [] rhs []]]
596− tfun cn c syn all (m, ty)
596+ tfun cn c syn all (m, (o, ty))
597 = do let ty' = insertConstraint c ty
597 = do let ty' = insertConstraint c ty
598 let mnames = take (length all) $ map (\x -> MN x "meth") [0..]
598 let mnames = take (length all) $ map (\x -> MN x "meth") [0..]
599 let capp = PApp fc (PRef fc cn) (map (pexp . PRef fc) mnames)
599 let capp = PApp fc (PRef fc cn) (map (pexp . PRef fc) mnames)
@@ -604,7 +604,7 @@ elabClass info syn fc constraints tn ps ds
604 iLOG (showImp True ty)
604 iLOG (showImp True ty)
605 iLOG (show (m, ty', capp, margs))
605 iLOG (show (m, ty', capp, margs))
606 iLOG (showImp True lhs ++ " = " ++ showImp True rhs)
606 iLOG (showImp True lhs ++ " = " ++ showImp True rhs)
607− return [PTy syn fc [] m ty',
607+ return [PTy syn fc o m ty',
608 PClauses fc [Inlinable,TCGen] m [PClause m lhs [] rhs []]]
608 PClauses fc [Inlinable,TCGen] m [PClause m lhs [] rhs []]]
610 getMArgs (PPi (Imp _ _) n ty sc) = IA : getMArgs sc
610 getMArgs (PPi (Imp _ _) n ty sc) = IA : getMArgs sc
@@ -650,8 +650,9 @@ elabInstance info syn fc cs n ps t ds
650 let ns = case n of
650 let ns = case n of
651 NS n ns' -> ns'
651 NS n ns' -> ns'
653+ let mtys = map (\ (n, (op, t)) ->
653− let mtys = map (\ (n, t) -> let t' = substMatches ips t in
654+ let t' = substMatches ips t in
654− (decorate ns n, coninsert cs t', t'))
655+ (decorate ns n, op, coninsert cs t', t'))
655 (class_methods ci)
656 (class_methods ci)
656 logLvl 3 (show (mtys, ips))
657 logLvl 3 (show (mtys, ips))
657 let ds' = insertDefaults (class_defaults ci) ns ds
658 let ds' = insertDefaults (class_defaults ci) ns ds
@@ -675,7 +676,7 @@ elabInstance info syn fc cs n ps t ds
675 iLOG (show idecl)
676 iLOG (show idecl)
676 elabDecl info idecl
677 elabDecl info idecl
678− mkMethApp (n, _, ty) = lamBind 0 ty (papp fc (PRef fc n) (methArgs 0 ty))
679+ mkMethApp (n, _, _, ty) = lamBind 0 ty (papp fc (PRef fc n) (methArgs 0 ty))
679 lamBind i (PPi (Constraint _ _) _ _ sc) sc'
680 lamBind i (PPi (Constraint _ _) _ _ sc) sc'
680 = PLam (MN i "meth") Placeholder (lamBind (i+1) sc sc')
681 = PLam (MN i "meth") Placeholder (lamBind (i+1) sc sc')
681 lamBind i (PPi _ n ty sc) sc' = PLam (MN i "meth") Placeholder (lamBind (i+1) sc sc')
682 lamBind i (PPi _ n ty sc) sc' = PLam (MN i "meth") Placeholder (lamBind (i+1) sc sc')
@@ -704,7 +705,7 @@ elabInstance info syn fc cs n ps t ds
704 decorate ns (UN n) = NS (UN ('!':n)) ns
705 decorate ns (UN n) = NS (UN ('!':n)) ns
705 decorate ns (NS (UN n) s) = NS (UN ('!':n)) ns
706 decorate ns (NS (UN n) s) = NS (UN ('!':n)) ns
707− mkTyDecl (n, t, _) = PTy syn fc [] n t
708+ mkTyDecl (n, op, t, _) = PTy syn fc op n t
709 conbind (ty : ns) x = PPi constraint (MN 0 "c") ty (conbind ns x)
710 conbind (ty : ns) x = PPi constraint (MN 0 "c") ty (conbind ns x)
710 conbind [] x = x
711 conbind [] x = x