@@ -352,33 +352,36 @@ deriving instance NFData Static
354-- Mark bindings with their explicitness, and laziness
354-- Mark bindings with their explicitness, and laziness
355−data Plicity = Imp { plazy :: Bool,
355+data Plicity = Imp { pargopts :: [ArgOpt],
356 pstatic :: Static,
356 pstatic :: Static,
357 pdocstr :: String,
357 pdocstr :: String,
358 pparam :: Bool }
358 pparam :: Bool }
359− | Exp { plazy :: Bool,
359+ | Exp { pargopts :: [ArgOpt],
360 pstatic :: Static,
360 pstatic :: Static,
361 pdocstr :: String,
361 pdocstr :: String,
362 pparam :: Bool }
362 pparam :: Bool }
363− | Constraint { plazy :: Bool,
363+ | Constraint { pargopts :: [ArgOpt],
364 pstatic :: Static,
364 pstatic :: Static,
365 pdocstr :: String }
365 pdocstr :: String }
366− | TacImp { plazy :: Bool,
366+ | TacImp { pargopts :: [ArgOpt],
367 pstatic :: Static,
367 pstatic :: Static,
368 pscript :: PTerm,
368 pscript :: PTerm,
369 pdocstr :: String }
369 pdocstr :: String }
370 deriving (Show, Eq)
370 deriving (Show, Eq)
372+plazy :: Plicity -> Bool
373+plazy tm = Lazy `elem` pargopts tm
373deriving instance Binary Plicity
376deriving instance Binary Plicity
374deriving instance NFData Plicity
377deriving instance NFData Plicity
377−impl = Imp False Dynamic "" False
380+impl = Imp [Lazy] Dynamic "" False
378−expl = Exp False Dynamic "" False
381+expl = Exp [] Dynamic "" False
379−expl_param = Exp False Dynamic "" True
382+expl_param = Exp [] Dynamic "" True
380−constraint = Constraint False Dynamic ""
383+constraint = Constraint [] Dynamic ""
381−tacimpl t = TacImp False Dynamic t ""
384+tacimpl t = TacImp [] Dynamic t ""
383data FnOpt = Inlinable -- always evaluate when simplifying
386data FnOpt = Inlinable -- always evaluate when simplifying
384 | TotalFn | PartialFn
387 | TotalFn | PartialFn
@@ -724,21 +727,31 @@ type PDo = PDo' PTerm
725data PArg' t = PImp { priority :: Int,
728data PArg' t = PImp { priority :: Int,
726 machine_inf :: Bool, -- true if the machine inferred it
729 machine_inf :: Bool, -- true if the machine inferred it
730+ argopts :: [ArgOpt],
727− lazyarg :: Bool, pname :: Name, getTm :: t,
731+ pname :: Name, getTm :: t,
728 pargdoc :: String }
732 pargdoc :: String }
729 | PExp { priority :: Int,
733 | PExp { priority :: Int,
734+ argopts :: [ArgOpt],
730− lazyarg :: Bool, getTm :: t,
735+ getTm :: t,
731 pargdoc :: String }
736 pargdoc :: String }
732 | PConstraint { priority :: Int,
737 | PConstraint { priority :: Int,
738+ argopts :: [ArgOpt],
733− lazyarg :: Bool, getTm :: t,
739+ getTm :: t,
734 pargdoc :: String }
740 pargdoc :: String }
735 | PTacImplicit { priority :: Int,
741 | PTacImplicit { priority :: Int,
742+ argopts :: [ArgOpt],
736− lazyarg :: Bool, pname :: Name,
743+ pname :: Name,
737 getScript :: t,
744 getScript :: t,
738 getTm :: t,
745 getTm :: t,
739 pargdoc :: String }
746 pargdoc :: String }
740 deriving (Show, Eq, Functor)
747 deriving (Show, Eq, Functor)
749+data ArgOpt = Lazy | HideDisplay
752+lazyarg :: PArg' t -> Bool
753+lazyarg tm = Lazy `elem` argopts tm
742instance Sized a => Sized (PArg' a) where
755instance Sized a => Sized (PArg' a) where
743 size (PImp p _ l nm trm _) = 1 + size nm + size trm
756 size (PImp p _ l nm trm _) = 1 + size nm + size trm
744 size (PExp p l trm _) = 1 + size trm
757 size (PExp p l trm _) = 1 + size trm
@@ -750,10 +763,10 @@ deriving instance Binary PArg'
750deriving instance NFData PArg'
763deriving instance NFData PArg'
753−pimp n t mach = PImp 1 mach True n t ""
766+pimp n t mach = PImp 1 mach [Lazy] n t ""
754−pexp t = PExp 1 False t ""
767+pexp t = PExp 1 [] t ""
755−pconst t = PConstraint 1 False t ""
768+pconst t = PConstraint 1 [] t ""
756−ptacimp n s t = PTacImplicit 2 True n s t ""
769+ptacimp n s t = PTacImplicit 2 [Lazy] n s t ""
758type PArg = PArg' PTerm
771type PArg = PArg' PTerm
@@ -1003,7 +1016,7 @@ prettyImp impl = prettySe 10
1003 prettySe 10 sc
1016 prettySe 10 sc
1004 prettySe p (PPi (Exp l s _ _) n ty sc)
1017 prettySe p (PPi (Exp l s _ _) n ty sc)
1005 | n `elem` allNamesIn sc || impl =
1018 | n `elem` allNamesIn sc || impl =
1006− let open = if l then text "|" <> lparen else lparen in
1019+ let open = if Lazy `elem` l then text "|" <> lparen else lparen in
1007 bracket p 2 $
1020 bracket p 2 $
1008 if size sc > breakingSize then
1021 if size sc > breakingSize then
1009 open <> pretty n <+> colon <+> prettySe 10 ty <> rparen <+>
1022 open <> pretty n <+> colon <+> prettySe 10 ty <> rparen <+>
@@ -1024,7 +1037,7 @@ prettyImp impl = prettySe 10
1024 _ -> empty
1037 _ -> empty
1025 prettySe p (PPi (Imp l s _ _) n ty sc)
1038 prettySe p (PPi (Imp l s _ _) n ty sc)
1026 | impl =
1039 | impl =
1027− let open = if l then text "|" <> lbrace else lbrace in
1040+ let open = if Lazy `elem` l then text "|" <> lbrace else lbrace in
1028 bracket p 2 $
1041 bracket p 2 $
1029 if size sc > breakingSize then
1042 if size sc > breakingSize then
1030 open <> pretty n <+> colon <+> prettySe 10 ty <> rbrace <+>
1043 open <> pretty n <+> colon <+> prettySe 10 ty <> rbrace <+>
@@ -1217,7 +1230,7 @@ showImp ist impl colour tm = se 10 [] tm where
1217 se p bnd (PPi (Exp l s _ param) n ty sc)
1230 se p bnd (PPi (Exp l s _ param) n ty sc)
1218 | n `elem` allNamesIn sc || impl
1231 | n `elem` allNamesIn sc || impl
1219 = bracket p 2 $
1232 = bracket p 2 $
1220− (if l then "|(" else "(") ++
1233+ (if Lazy `elem` l then "|(" else "(") ++
1221 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1234 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1223 (if (impl && param) then "P" else "") ++
1236 (if (impl && param) then "P" else "") ++
@@ -1228,7 +1241,7 @@ showImp ist impl colour tm = se 10 [] tm where
1228 Static -> "[static] "
1241 Static -> "[static] "
1230 se p bnd (PPi (Imp l s _ _) n ty sc)
1243 se p bnd (PPi (Imp l s _ _) n ty sc)
1231− | impl = bracket p 2 $ (if l then "|{" else "{") ++
1244+ | impl = bracket p 2 $ (if Lazy `elem` l then "|{" else "{") ++
1232 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1245 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
1233 "} " ++ st ++ "-> " ++ se 10 ((n, True):bnd) sc
1246 "} " ++ st ++ "-> " ++ se 10 ((n, True):bnd) sc
1234 | otherwise = se 10 ((n, True):bnd) sc
1247 | otherwise = se 10 ((n, True):bnd) sc