@@ -358,6 +358,9 @@ data Plicity = Imp { plazy :: Bool,
358358 pstatic :: Static }
359359 | Constraint { plazy :: Bool,
360360 pstatic :: Static }
361+ | TacImp { plazy :: Bool,
362+ pstatic :: Static,
363+ pscript :: PTerm }
361364 deriving (Show, Eq)
362365
363366{-!
@@ -367,6 +370,7 @@ deriving instance Binary Plicity
367370impl = Imp False Dynamic
368371expl = Exp False Dynamic
369372constraint = Constraint False Static
373+tacimpl = TacImp False Dynamic
370374
371375data FnOpt = Inlinable | TotalFn | TCGen
372376 deriving (Show, Eq)
@@ -544,6 +548,10 @@ data PArg' t = PImp { priority :: Int,
544548 lazyarg :: Bool, getTm :: t }
545549 | PConstraint { priority :: Int,
546550 lazyarg :: Bool, getTm :: t }
551+ | PTacImplicit { priority :: Int,
552+ lazyarg :: Bool, pname :: Name,
553+ getScript :: t,
554+ getTm :: t }
547555 deriving (Show, Eq, Functor)
548556{-!
549557deriving instance Binary PArg'
@@ -552,6 +560,7 @@ deriving instance Binary PArg'
552560pimp = PImp 0 True
553561pexp = PExp 0 False
554562pconst = PConstraint 0 False
563+ptacimp = PTacImplicit 0 True
555564
556565type PArg = PArg' PTerm
557566
@@ -767,10 +776,12 @@ showImp impl tm = se 10 tm where
767776 sArg (PImp _ _ n tm) = siArg (n, tm)
768777 sArg (PExp _ _ tm) = seArg tm
769778 sArg (PConstraint _ _ tm) = scArg tm
779+ sArg (PTacImplicit _ _ n _ tm) = stiArg (n, tm)
770780
771781 seArg arg = " " ++ se 0 arg
772782 siArg (n, val) = " {" ++ show n ++ " = " ++ se 10 val ++ "}"
773783 scArg val = " {{" ++ se 10 val ++ "}}"
784+ stiArg (n, val) = " {auto " ++ show n ++ " = " ++ se 10 val ++ "}"
774785
775786 bracket outer inner str | inner > outer = "(" ++ str ++ ")"
776787 | otherwise = str
@@ -1063,6 +1074,14 @@ implicitise syn ist tm
10631074 put (PConstraint 10 l ty : decls,
10641075 nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
10651076 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]
1080+ _ -> [])
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
10661085 imps top env (PEq _ l r)
10671086 = do (decls, ns) <- get
10681087 let isn = namesIn uvars ist l ++ namesIn uvars ist r
@@ -1171,6 +1190,11 @@ aiFn ist fc f as
11711190 case find n given [] of
11721191 Just (tm, given') -> PImp p l n tm : insertImpl ps given'
11731192 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
11741198 insertImpl expected [] = []
11751199 insertImpl _ given = given
11761200