@@ -111,6 +111,7 @@ data IState = IState {
111111 idris_metavars :: [(Name, (Maybe Name, Int, Bool))], -- ^ The currently defined but not proven metavariables
112112 idris_coercions :: [Name],
113113 idris_transforms :: [(Term, Term)],
114+ idris_errRev :: [(Term, Term)],
114115 syntax_rules :: [Syntax],
115116 syntax_keywords :: [String],
116117 imported :: [FilePath], -- ^ The imported modules
@@ -187,6 +188,7 @@ data IBCWrite = IBCFix FixDecl
187188 | IBCTotal Name Totality
188189 | IBCFlags Name [FnOpt]
189190 | IBCTrans (Term, Term)
191+ | IBCErrRev (Term, Term)
190192 | IBCCG Name
191193 | IBCDoc Name
192194 | IBCCoercion Name
@@ -203,7 +205,7 @@ idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
203205 emptyContext emptyContext emptyContext emptyContext
204206 emptyContext emptyContext emptyContext emptyContext
205207 emptyContext
206− [] [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] []
208+ [] [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] [] []
207209 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
208210 True defaultTheme stdout [] (0, emptyContext) emptyContext
209211
@@ -357,33 +359,36 @@ deriving instance NFData Static
357359!-}
358360
359361-- Mark bindings with their explicitness, and laziness
360−data Plicity = Imp { plazy :: Bool,
362+data Plicity = Imp { pargopts :: [ArgOpt],
361363 pstatic :: Static,
362364 pdocstr :: String,
363365 pparam :: Bool }
364− | Exp { plazy :: Bool,
366+ | Exp { pargopts :: [ArgOpt],
365367 pstatic :: Static,
366368 pdocstr :: String,
367369 pparam :: Bool }
368− | Constraint { plazy :: Bool,
370+ | Constraint { pargopts :: [ArgOpt],
369371 pstatic :: Static,
370372 pdocstr :: String }
371− | TacImp { plazy :: Bool,
373+ | TacImp { pargopts :: [ArgOpt],
372374 pstatic :: Static,
373375 pscript :: PTerm,
374376 pdocstr :: String }
375377 deriving (Show, Eq)
376378
379+plazy :: Plicity -> Bool
380+plazy tm = Lazy `elem` pargopts tm
381+
377382{-!
378383deriving instance Binary Plicity
379384deriving instance NFData Plicity
380385!-}
381386
382−impl = Imp False Dynamic "" False
383−expl = Exp False Dynamic "" False
384−expl_param = Exp False Dynamic "" True
385−constraint = Constraint False Dynamic ""
386−tacimpl t = TacImp False Dynamic t ""
387+impl = Imp [Lazy] Dynamic "" False
388+expl = Exp [] Dynamic "" False
389+expl_param = Exp [] Dynamic "" True
390+constraint = Constraint [] Dynamic ""
391+tacimpl t = TacImp [] Dynamic t ""
387392
388393data FnOpt = Inlinable -- always evaluate when simplifying
389394 | TotalFn | PartialFn
@@ -393,6 +398,7 @@ data FnOpt = Inlinable -- always evaluate when simplifying
393398 | Implicit -- implicit coercion
394399 | CExport String -- export, with a C name
395400 | ErrorHandler -- ^^ an error handler for use with the ErrorReflection extension
401+ | ErrorReverse -- ^^ attempt to reverse normalise before showing in error
396402 | Reflection -- a reflecting function, compile-time only
397403 | Specialise [(Name, Maybe Int)] -- specialise it, freeze these names
398404 deriving (Show, Eq)
@@ -413,6 +419,7 @@ dictionary = elem Dictionary
413419-- | Data declaration options
414420data DataOpt = Codata -- Set if the the data-type is coinductive
415421 | DefaultEliminator -- Set if an eliminator should be generated for data type
422+ | DataErrRev
416423 deriving (Show, Eq)
417424
418425type DataOpts = [DataOpt]
@@ -729,21 +736,31 @@ type PDo = PDo' PTerm
729736
730737data PArg' t = PImp { priority :: Int,
731738 machine_inf :: Bool, -- true if the machine inferred it
732− lazyarg :: Bool, pname :: Name, getTm :: t,
739+ argopts :: [ArgOpt],
740+ pname :: Name, getTm :: t,
733741 pargdoc :: String }
734742 | PExp { priority :: Int,
735− lazyarg :: Bool, getTm :: t,
743+ argopts :: [ArgOpt],
744+ getTm :: t,
736745 pargdoc :: String }
737746 | PConstraint { priority :: Int,
738− lazyarg :: Bool, getTm :: t,
747+ argopts :: [ArgOpt],
748+ getTm :: t,
739749 pargdoc :: String }
740750 | PTacImplicit { priority :: Int,
741− lazyarg :: Bool, pname :: Name,
751+ argopts :: [ArgOpt],
752+ pname :: Name,
742753 getScript :: t,
743754 getTm :: t,
744755 pargdoc :: String }
745756 deriving (Show, Eq, Functor)
746757
758+data ArgOpt = Lazy | HideDisplay
759+ deriving (Show, Eq)
760+
761+lazyarg :: PArg' t -> Bool
762+lazyarg tm = Lazy `elem` argopts tm
763+
747764instance Sized a => Sized (PArg' a) where
748765 size (PImp p _ l nm trm _) = 1 + size nm + size trm
749766 size (PExp p l trm _) = 1 + size trm
@@ -755,10 +772,10 @@ deriving instance Binary PArg'
755772deriving instance NFData PArg'
756773!-}
757774
758−pimp n t mach = PImp 1 mach True n t ""
759−pexp t = PExp 1 False t ""
760−pconst t = PConstraint 1 False t ""
761−ptacimp n s t = PTacImplicit 2 True n s t ""
775+pimp n t mach = PImp 1 mach [Lazy] n t ""
776+pexp t = PExp 1 [] t ""
777+pconst t = PConstraint 1 [] t ""
778+ptacimp n s t = PTacImplicit 2 [Lazy] n s t ""
762779
763780type PArg = PArg' PTerm
764781
@@ -801,6 +818,7 @@ deriving instance NFData OptInfo
801818
802819data TypeInfo = TI { con_names :: [Name],
803820 codata :: Bool,
821+ data_opts :: DataOpts,
804822 param_pos :: [Int] }
805823 deriving Show
806824{-!
@@ -1008,7 +1026,7 @@ prettyImp impl = prettySe 10
10081026 prettySe 10 sc
10091027 prettySe p (PPi (Exp l s _ _) n ty sc)
10101028 | n `elem` allNamesIn sc || impl =
1011− let open = if l then text "|" <> lparen else lparen in
1029+ let open = if Lazy `elem` l then text "|" <> lparen else lparen in
10121030 bracket p 2 $
10131031 if size sc > breakingSize then
10141032 open <> pretty n <+> colon <+> prettySe 10 ty <> rparen <+>
@@ -1029,7 +1047,7 @@ prettyImp impl = prettySe 10
10291047 _ -> empty
10301048 prettySe p (PPi (Imp l s _ _) n ty sc)
10311049 | impl =
1032− let open = if l then text "|" <> lbrace else lbrace in
1050+ let open = if Lazy `elem` l then text "|" <> lbrace else lbrace in
10331051 bracket p 2 $
10341052 if size sc > breakingSize then
10351053 open <> pretty n <+> colon <+> prettySe 10 ty <> rbrace <+>
@@ -1222,7 +1240,7 @@ showImp ist impl colour tm = se 10 [] tm where
12221240 se p bnd (PPi (Exp l s _ param) n ty sc)
12231241 | n `elem` allNamesIn sc || impl
12241242 = bracket p 2 $
1225− (if l then "|(" else "(") ++
1243+ (if Lazy `elem` l then "|(" else "(") ++
12261244 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
12271245 ") " ++
12281246 (if (impl && param) then "P" else "") ++
@@ -1233,7 +1251,7 @@ showImp ist impl colour tm = se 10 [] tm where
12331251 Static -> "[static] "
12341252 _ -> ""
12351253 se p bnd (PPi (Imp l s _ _) n ty sc)
1236− | impl = bracket p 2 $ (if l then "|{" else "{") ++
1254+ | impl = bracket p 2 $ (if Lazy `elem` l then "|{" else "{") ++
12371255 perhapsColourise colouriseBound (show n) ++ " : " ++ se 10 bnd ty ++
12381256 "} " ++ st ++ "-> " ++ se 10 ((n, True):bnd) sc
12391257 | otherwise = se 10 ((n, True):bnd) sc
@@ -1247,6 +1265,9 @@ showImp ist impl colour tm = se 10 [] tm where
12471265 "{tacimp " ++ (perhapsColourise colouriseBound (show n)) ++ " : " ++ se 10 bnd ty ++ "} -> " ++
12481266 se 10 ((n, False):bnd) sc
12491267 se p bnd (PMatchApp _ f) = "match " ++ show f
1268+ se p bnd (PApp _ hd@(PRef fc f) [tm])
1269+ | PConstant (Idris.Core.TT.Str str) <- getTm tm,
1270+ f == sUN "Symbol_" = "'" ++ se 10 bnd (PRef fc (sUN str))
12501271 se p bnd (PApp _ hd@(PRef _ f) [])
12511272 | not impl = se p bnd hd
12521273 se p bnd (PAppBind _ hd@(PRef _ f) [])