@@ -68,34 +68,36 @@ toplevel = EInfo [] emptyContext id Nothing Nothing (\_ _ _ -> fail "Not impleme
68eInfoNames :: ElabInfo -> [Name]
68eInfoNames :: ElabInfo -> [Name]
69eInfoNames info = map fst (params info) ++ M.keys (inblock info)
69eInfoNames info = map fst (params info) ++ M.keys (inblock info)
71−data IOption = IOption { opt_logLevel :: Int,
71+data IOption = IOption {
73+ , opt_logcats :: [LogCat] -- ^ List of logging categories.
72− opt_typecase :: Bool,
74+ , opt_typecase :: Bool
73− opt_typeintype :: Bool,
75+ , opt_typeintype :: Bool
74− opt_coverage :: Bool,
76+ , opt_coverage :: Bool
75− opt_showimp :: Bool, -- ^^ show implicits
77+ , opt_showimp :: Bool -- ^ show implicits
76− opt_errContext :: Bool,
78+ , opt_errContext :: Bool
77− opt_repl :: Bool,
79+ , opt_repl :: Bool
78− opt_verbose :: Bool,
80+ , opt_verbose :: Bool
79− opt_nobanner :: Bool,
81+ , opt_nobanner :: Bool
80− opt_quiet :: Bool,
82+ , opt_quiet :: Bool
81− opt_codegen :: Codegen,
83+ , opt_codegen :: Codegen
82− opt_outputTy :: OutputType,
84+ , opt_outputTy :: OutputType
83− opt_ibcsubdir :: FilePath,
85+ , opt_ibcsubdir :: FilePath
84− opt_importdirs :: [FilePath],
86+ , opt_importdirs :: [FilePath]
85− opt_triple :: String,
87+ , opt_triple :: String
86− opt_cpu :: String,
88+ , opt_cpu :: String
87− opt_cmdline :: [Opt], -- remember whole command line
89+ , opt_cmdline :: [Opt] -- remember whole command line
88− opt_origerr :: Bool,
90+ , opt_origerr :: Bool
89− opt_autoSolve :: Bool, -- ^ automatically apply "solve" tactic in prover
91+ , opt_autoSolve :: Bool -- ^ automatically apply "solve" tactic in prover
90− opt_autoImport :: [FilePath], -- ^ e.g. Builtins+Prelude
92+ , opt_autoImport :: [FilePath] -- ^ e.g. Builtins+Prelude
91− opt_optimise :: [Optimisation],
93+ , opt_optimise :: [Optimisation]
92− opt_printdepth :: Maybe Int,
94+ , opt_printdepth :: Maybe Int
93− opt_evaltypes :: Bool, -- ^ normalise types in :t
95+ , opt_evaltypes :: Bool -- ^ normalise types in :t
94− opt_desugarnats :: Bool
96+ , opt_desugarnats :: Bool
96− deriving (Show, Eq)
97+ } deriving (Show, Eq)
98defaultOpts = IOption { opt_logLevel = 0
99defaultOpts = IOption { opt_logLevel = 0
99 , opt_typecase = False
101 , opt_typecase = False
100 , opt_typeintype = False
102 , opt_typeintype = False
101 , opt_coverage = True
103 , opt_coverage = True
@@ -135,7 +137,7 @@ defaultOptimise = [PETransform]
136-- | Pretty printing options with default verbosity.
138-- | Pretty printing options with default verbosity.
137defaultPPOption :: PPOption
139defaultPPOption :: PPOption
138−defaultPPOption = PPOption { ppopt_impl = False,
140+defaultPPOption = PPOption { ppopt_impl = False,
139 ppopt_desugarnats = False,
141 ppopt_desugarnats = False,
140 ppopt_pinames = False,
142 ppopt_pinames = False,
141 ppopt_depth = Just 200 }
143 ppopt_depth = Just 200 }
@@ -406,6 +408,7 @@ data Command = Quit
407 | Universes
409 | Universes
408 | LogLvl Int
410 | LogLvl Int
411+ | LogCategory [LogCat]
409 | Spec PTerm
412 | Spec PTerm
410 | WHNF PTerm
413 | WHNF PTerm
411 | TestInline PTerm
414 | TestInline PTerm
@@ -451,6 +454,28 @@ data Command = Quit
452data OutputFmt = HTMLOutput | LaTeXOutput
455data OutputFmt = HTMLOutput | LaTeXOutput
457+-- | Recognised logging categories for the Idris compiler.
468+ deriving (Show, Eq, Ord)
470+backendCats :: [LogCat]
471+backendCats = [IDefun, IInline, IResolve, ICodeGen]
473+parserCats :: [LogCat]
474+parserCats = [IParse]
476+checkingCats :: [LogCat]
477+checkingCats = [IElab, ICover, IUnify, ITotal, IElab]
454data Opt = Filename String
479data Opt = Filename String
456 | NoBanner
481 | NoBanner
@@ -466,6 +491,7 @@ data Opt = Filename String
466 | NoBuiltins -- only for the really primitive stuff!
491 | NoBuiltins -- only for the really primitive stuff!
468 | OLogging Int
493 | OLogging Int
469 | Output String
495 | Output String
470 | Interface
496 | Interface
471 | TypeCase
497 | TypeCase
@@ -767,7 +793,7 @@ data PData' t = PDatadecl { d_name :: Name, -- ^ The name of the datatype
767 | PLaterdecl { d_name :: Name, d_name_fc :: FC, d_tcon :: t }
793 | PLaterdecl { d_name :: Name, d_name_fc :: FC, d_tcon :: t }
768 -- ^ "Placeholder" for data whose constructors are defined later
794 -- ^ "Placeholder" for data whose constructors are defined later
769 deriving Functor
795 deriving Functor
771-- | Transform the FCs in a PData and its associated terms. The first
797-- | Transform the FCs in a PData and its associated terms. The first
772-- function transforms the general-purpose FCs, and the second transforms
798-- function transforms the general-purpose FCs, and the second transforms
773-- those that are used for semantic source highlighting, so they can be
799-- those that are used for semantic source highlighting, so they can be
@@ -1088,7 +1114,7 @@ data PTactic' t = Intro [Name] | Intros | Focus Name
1088 | MatchRefine Name
1114 | MatchRefine Name
1089 | LetTac Name t | LetTacTy Name t t
1115 | LetTac Name t | LetTacTy Name t t
1090 | Exact t | Compute | Trivial | TCInstance
1116 | Exact t | Compute | Trivial | TCInstance
1091− | ProofSearch Bool Bool Int (Maybe Name)
1117+ | ProofSearch Bool Bool Int (Maybe Name)
1092 [Name] -- allowed local names
1118 [Name] -- allowed local names
1093 [Name] -- hints
1119 [Name] -- hints
1094 -- ^ the bool is whether to search recursively
1120 -- ^ the bool is whether to search recursively
@@ -1179,7 +1205,7 @@ type PDo = PDo' PTerm
1179data PArg' t = PImp { priority :: Int,
1205data PArg' t = PImp { priority :: Int,
1180 machine_inf :: Bool, -- true if the machine inferred it
1206 machine_inf :: Bool, -- true if the machine inferred it
1181 argopts :: [ArgOpt],
1207 argopts :: [ArgOpt],
1182− pname :: Name,
1208+ pname :: Name,
1183 getTm :: t }
1209 getTm :: t }
1184 | PExp { priority :: Int,
1210 | PExp { priority :: Int,
1185 argopts :: [ArgOpt],
1211 argopts :: [ArgOpt],
@@ -1890,7 +1916,7 @@ pprintPTerm ppo bnd docArgs infixes = prettySe (ppopt_depth ppo) startPrec bnd
1890 bracket p funcAppPrec . group . align . hang 2 $
1916 bracket p funcAppPrec . group . align . hang 2 $
1891 text "%runElab" <$>
1917 text "%runElab" <$>
1892 prettySe (decD d) funcAppPrec bnd tm
1918 prettySe (decD d) funcAppPrec bnd tm
1893− prettySe d p bnd (PConstSugar fc tm) = prettySe d p bnd tm -- should never occur, but harmless
1919+ prettySe d p bnd (PConstSugar fc tm) = prettySe d p bnd tm -- should never occur, but harmless
1895 prettySe d p bnd _ = text "missing pretty-printer for term"
1921 prettySe d p bnd _ = text "missing pretty-printer for term"
@@ -2137,7 +2163,7 @@ showTm ist = displayDecorated (consoleDecorate ist) .
2137showTmImpls :: PTerm -> String
2163showTmImpls :: PTerm -> String
2138showTmImpls = flip (displayS . renderCompact . prettyImp verbosePPOption) ""
2164showTmImpls = flip (displayS . renderCompact . prettyImp verbosePPOption) ""
2140−-- | Show a term with specific options
2166+-- | Show a term with specific options
2141showTmOpts :: PPOption -> PTerm -> String
2167showTmOpts :: PPOption -> PTerm -> String
2142showTmOpts opt = flip (displayS . renderPretty 1.0 10000000 . prettyImp opt) ""
2168showTmOpts opt = flip (displayS . renderPretty 1.0 10000000 . prettyImp opt) ""
@@ -2253,7 +2279,7 @@ boundNamesIn tm = S.toList (ni 0 S.empty tm)
2254-- Return names which are valid implicits in the given term (type).
2280-- Return names which are valid implicits in the given term (type).
2255implicitNamesIn :: [Name] -> IState -> PTerm -> [Name]
2281implicitNamesIn :: [Name] -> IState -> PTerm -> [Name]
2256−implicitNamesIn uvars ist tm
2282+implicitNamesIn uvars ist tm
2257 = let (imps, fns) = execState (ni 0 [] tm) ([], []) in
2283 = let (imps, fns) = execState (ni 0 [] tm) ([], []) in
2258 nub imps \\ nub fns
2284 nub imps \\ nub fns
@@ -2282,15 +2308,15 @@ implicitNamesIn uvars ist tm
2282 ni 0 env (PRef _ _ n)
2308 ni 0 env (PRef _ _ n)
2283 | not (n `elem` env) && implicitable n || n `elem` uvars = addImp n
2309 | not (n `elem` env) && implicitable n || n `elem` uvars = addImp n
2284 ni 0 env (PApp _ f@(PRef _ _ n) as)
2310 ni 0 env (PApp _ f@(PRef _ _ n) as)
2285− | n `elem` uvars = do ni 0 env f
2311+ | n `elem` uvars = do ni 0 env f
2286 mapM_ (ni 0 env) (map getTm as)
2312 mapM_ (ni 0 env) (map getTm as)
2287 | otherwise = do case lookupTy n (tt_ctxt ist) of
2313 | otherwise = do case lookupTy n (tt_ctxt ist) of
2288 [] -> return ()
2314 [] -> return ()
2289 _ -> addFn n
2315 _ -> addFn n
2290 mapM_ (ni 0 env) (map getTm as)
2316 mapM_ (ni 0 env) (map getTm as)
2291− ni 0 env (PApp _ f as) = do ni 0 env f
2317+ ni 0 env (PApp _ f as) = do ni 0 env f
2292 mapM_ (ni 0 env) (map getTm as)
2318 mapM_ (ni 0 env) (map getTm as)
2293− ni 0 env (PAppBind _ f as) = do ni 0 env f
2319+ ni 0 env (PAppBind _ f as) = do ni 0 env f
2294 mapM_ (ni 0 env) (map getTm as)
2320 mapM_ (ni 0 env) (map getTm as)
2295 ni 0 env (PCase _ c os) = do ni 0 env c
2321 ni 0 env (PCase _ c os) = do ni 0 env c
2296 -- names in 'os', not counting the names bound in the cases
2322 -- names in 'os', not counting the names bound in the cases
@@ -2307,7 +2333,7 @@ implicitNamesIn uvars ist tm
2307 ni 0 env (PTyped l r) = do ni 0 env l; ni 0 env r
2333 ni 0 env (PTyped l r) = do ni 0 env l; ni 0 env r
2308 ni 0 env (PPair _ _ _ l r) = do ni 0 env l; ni 0 env r
2334 ni 0 env (PPair _ _ _ l r) = do ni 0 env l; ni 0 env r
2309 ni 0 env (PDPair _ _ _ (PRef _ _ n) t r) = do ni 0 env t; ni 0 (n:env) r
2335 ni 0 env (PDPair _ _ _ (PRef _ _ n) t r) = do ni 0 env t; ni 0 (n:env) r
2310− ni 0 env (PDPair _ _ _ l t r) = do ni 0 env l
2336+ ni 0 env (PDPair _ _ _ l t r) = do ni 0 env l
2311 ni 0 env t
2337 ni 0 env t
2312 ni 0 env r
2338 ni 0 env r
2313 ni 0 env (PAlternative ns a as) = mapM_ (ni 0 env) as
2339 ni 0 env (PAlternative ns a as) = mapM_ (ni 0 env) as