@@ -358,6 +358,9 @@ data Plicity = Imp { plazy :: Bool,
358 pstatic :: Static }
358 pstatic :: Static }
359 | Constraint { plazy :: Bool,
359 | Constraint { plazy :: Bool,
360 pstatic :: Static }
360 pstatic :: Static }
361+ | TacImp { plazy :: Bool,
361 deriving (Show, Eq)
364 deriving (Show, Eq)
@@ -367,6 +370,7 @@ deriving instance Binary Plicity
367impl = Imp False Dynamic
370impl = Imp False Dynamic
368expl = Exp False Dynamic
371expl = Exp False Dynamic
369constraint = Constraint False Static
372constraint = Constraint False Static
373+tacimpl = TacImp False Dynamic
371data FnOpt = Inlinable | TotalFn | TCGen
375data FnOpt = Inlinable | TotalFn | TCGen
372 deriving (Show, Eq)
376 deriving (Show, Eq)
@@ -544,6 +548,10 @@ data PArg' t = PImp { priority :: Int,
544 lazyarg :: Bool, getTm :: t }
548 lazyarg :: Bool, getTm :: t }
545 | PConstraint { priority :: Int,
549 | PConstraint { priority :: Int,
546 lazyarg :: Bool, getTm :: t }
550 lazyarg :: Bool, getTm :: t }
551+ | PTacImplicit { priority :: Int,
552+ lazyarg :: Bool, pname :: Name,
547 deriving (Show, Eq, Functor)
555 deriving (Show, Eq, Functor)
549deriving instance Binary PArg'
557deriving instance Binary PArg'
@@ -552,6 +560,7 @@ deriving instance Binary PArg'
552pimp = PImp 0 True
560pimp = PImp 0 True
553pexp = PExp 0 False
561pexp = PExp 0 False
554pconst = PConstraint 0 False
562pconst = PConstraint 0 False
563+ptacimp = PTacImplicit 0 True
556type PArg = PArg' PTerm
565type PArg = PArg' PTerm
@@ -767,10 +776,12 @@ showImp impl tm = se 10 tm where
767 sArg (PImp _ _ n tm) = siArg (n, tm)
776 sArg (PImp _ _ n tm) = siArg (n, tm)
768 sArg (PExp _ _ tm) = seArg tm
777 sArg (PExp _ _ tm) = seArg tm
769 sArg (PConstraint _ _ tm) = scArg tm
778 sArg (PConstraint _ _ tm) = scArg tm
779+ sArg (PTacImplicit _ _ n _ tm) = stiArg (n, tm)
771 seArg arg = " " ++ se 0 arg
781 seArg arg = " " ++ se 0 arg
772 siArg (n, val) = " {" ++ show n ++ " = " ++ se 10 val ++ "}"
782 siArg (n, val) = " {" ++ show n ++ " = " ++ se 10 val ++ "}"
773 scArg val = " {{" ++ se 10 val ++ "}}"
783 scArg val = " {{" ++ se 10 val ++ "}}"
784+ stiArg (n, val) = " {auto " ++ show n ++ " = " ++ se 10 val ++ "}"
775 bracket outer inner str | inner > outer = "(" ++ str ++ ")"
786 bracket outer inner str | inner > outer = "(" ++ str ++ ")"
776 | otherwise = str
787 | otherwise = str
@@ -1063,6 +1074,14 @@ implicitise syn ist tm
1063 put (PConstraint 10 l ty : decls,
1074 put (PConstraint 10 l ty : decls,
1064 nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
1075 nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
1065 imps True (n:env) sc
1076 imps True (n:env) sc
1077+ imps top env (PPi (TacImp l _ scr) n ty sc)
1078+ = do let isn = nub (namesIn uvars ist ty ++ case sc of
1079+ (PRef _ x) -> namesIn uvars ist sc `dropAll` [n]
1081+ (decls, ns) <- get -- ignore decls in HO types
1082+ put (PTacImplicit 10 l n scr ty : decls,
1083+ nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
1084+ imps True (n:env) sc
1066 imps top env (PEq _ l r)
1085 imps top env (PEq _ l r)
1067 = do (decls, ns) <- get
1086 = do (decls, ns) <- get
1068 let isn = namesIn uvars ist l ++ namesIn uvars ist r
1087 let isn = namesIn uvars ist l ++ namesIn uvars ist r
@@ -1171,6 +1190,11 @@ aiFn ist fc f as
1171 case find n given [] of
1190 case find n given [] of
1172 Just (tm, given') -> PImp p l n tm : insertImpl ps given'
1191 Just (tm, given') -> PImp p l n tm : insertImpl ps given'
1173 Nothing -> PImp p l n Placeholder : insertImpl ps given
1192 Nothing -> PImp p l n Placeholder : insertImpl ps given
1193+ insertImpl (PTacImplicit p l n sc ty : ps) given =
1194+ case find n given [] of
1195+ Just (tm, given') -> PTacImplicit p l n sc tm : insertImpl ps given'
1196+ Nothing -> PTacImplicit p l n sc sc
1197+ : insertImpl ps given
1174 insertImpl expected [] = []
1198 insertImpl expected [] = []
1175 insertImpl _ given = given
1199 insertImpl _ given = given