@@ -68,34 +68,36 @@ toplevel = EInfo [] emptyContext id Nothing Nothing (\_ _ _ -> fail "Not impleme
6868eInfoNames :: ElabInfo -> [Name]
6969eInfoNames info = map fst (params info) ++ M.keys (inblock info)
7070
71−data IOption = IOption { opt_logLevel :: Int,
72− opt_typecase :: Bool,
73− opt_typeintype :: Bool,
74− opt_coverage :: Bool,
75− opt_showimp :: Bool, -- ^^ show implicits
76− opt_errContext :: Bool,
77− opt_repl :: Bool,
78− opt_verbose :: Bool,
79− opt_nobanner :: Bool,
80− opt_quiet :: Bool,
81− opt_codegen :: Codegen,
82− opt_outputTy :: OutputType,
83− opt_ibcsubdir :: FilePath,
84− opt_importdirs :: [FilePath],
85− opt_triple :: String,
86− opt_cpu :: String,
87− opt_cmdline :: [Opt], -- remember whole command line
88− opt_origerr :: Bool,
89− opt_autoSolve :: Bool, -- ^ automatically apply "solve" tactic in prover
90− opt_autoImport :: [FilePath], -- ^ e.g. Builtins+Prelude
91− opt_optimise :: [Optimisation],
92− opt_printdepth :: Maybe Int,
93− opt_evaltypes :: Bool, -- ^ normalise types in :t
94− opt_desugarnats :: Bool
95− }
96− deriving (Show, Eq)
71+data IOption = IOption {
72+ opt_logLevel :: Int
73+ , opt_logcats :: [LogCat] -- ^ List of logging categories.
74+ , opt_typecase :: Bool
75+ , opt_typeintype :: Bool
76+ , opt_coverage :: Bool
77+ , opt_showimp :: Bool -- ^ show implicits
78+ , opt_errContext :: Bool
79+ , opt_repl :: Bool
80+ , opt_verbose :: Bool
81+ , opt_nobanner :: Bool
82+ , opt_quiet :: Bool
83+ , opt_codegen :: Codegen
84+ , opt_outputTy :: OutputType
85+ , opt_ibcsubdir :: FilePath
86+ , opt_importdirs :: [FilePath]
87+ , opt_triple :: String
88+ , opt_cpu :: String
89+ , opt_cmdline :: [Opt] -- remember whole command line
90+ , opt_origerr :: Bool
91+ , opt_autoSolve :: Bool -- ^ automatically apply "solve" tactic in prover
92+ , opt_autoImport :: [FilePath] -- ^ e.g. Builtins+Prelude
93+ , opt_optimise :: [Optimisation]
94+ , opt_printdepth :: Maybe Int
95+ , opt_evaltypes :: Bool -- ^ normalise types in :t
96+ , opt_desugarnats :: Bool
97+ } deriving (Show, Eq)
9798
9899defaultOpts = IOption { opt_logLevel = 0
100+ , opt_logcats = []
99101 , opt_typecase = False
100102 , opt_typeintype = False
101103 , opt_coverage = True
@@ -135,7 +137,7 @@ defaultOptimise = [PETransform]
135137
136138-- | Pretty printing options with default verbosity.
137139defaultPPOption :: PPOption
138−defaultPPOption = PPOption { ppopt_impl = False,
140+defaultPPOption = PPOption { ppopt_impl = False,
139141 ppopt_desugarnats = False,
140142 ppopt_pinames = False,
141143 ppopt_depth = Just 200 }
@@ -406,6 +408,7 @@ data Command = Quit
406408 | Proofs
407409 | Universes
408410 | LogLvl Int
411+ | LogCategory [LogCat]
409412 | Spec PTerm
410413 | WHNF PTerm
411414 | TestInline PTerm
@@ -451,6 +454,28 @@ data Command = Quit
451454
452455data OutputFmt = HTMLOutput | LaTeXOutput
453456
457+-- | Recognised logging categories for the Idris compiler.
458+data LogCat = IParse
459+ | IElab
460+ | ICover
461+ | IUnify
462+ | ITotal
463+ | IErase
464+ | IDefun
465+ | IInline
466+ | IResolve
467+ | ICodeGen
468+ deriving (Show, Eq, Ord)
469+
470+backendCats :: [LogCat]
471+backendCats = [IDefun, IInline, IResolve, ICodeGen]
472+
473+parserCats :: [LogCat]
474+parserCats = [IParse]
475+
476+checkingCats :: [LogCat]
477+checkingCats = [IElab, ICover, IUnify, ITotal, IElab]
478+
454479data Opt = Filename String
455480 | Quiet
456481 | NoBanner
@@ -466,6 +491,7 @@ data Opt = Filename String
466491 | NoBuiltins -- only for the really primitive stuff!
467492 | NoREPL
468493 | OLogging Int
494+ | OLogCats [LogCat]
469495 | Output String
470496 | Interface
471497 | TypeCase
@@ -767,7 +793,7 @@ data PData' t = PDatadecl { d_name :: Name, -- ^ The name of the datatype
767793 | PLaterdecl { d_name :: Name, d_name_fc :: FC, d_tcon :: t }
768794 -- ^ "Placeholder" for data whose constructors are defined later
769795 deriving Functor
770−
796+
771797-- | Transform the FCs in a PData and its associated terms. The first
772798-- function transforms the general-purpose FCs, and the second transforms
773799-- those that are used for semantic source highlighting, so they can be
@@ -1088,7 +1114,7 @@ data PTactic' t = Intro [Name] | Intros | Focus Name
10881114 | MatchRefine Name
10891115 | LetTac Name t | LetTacTy Name t t
10901116 | Exact t | Compute | Trivial | TCInstance
1091− | ProofSearch Bool Bool Int (Maybe Name)
1117+ | ProofSearch Bool Bool Int (Maybe Name)
10921118 [Name] -- allowed local names
10931119 [Name] -- hints
10941120 -- ^ the bool is whether to search recursively
@@ -1179,7 +1205,7 @@ type PDo = PDo' PTerm
11791205data PArg' t = PImp { priority :: Int,
11801206 machine_inf :: Bool, -- true if the machine inferred it
11811207 argopts :: [ArgOpt],
1182− pname :: Name,
1208+ pname :: Name,
11831209 getTm :: t }
11841210 | PExp { priority :: Int,
11851211 argopts :: [ArgOpt],
@@ -1890,7 +1916,7 @@ pprintPTerm ppo bnd docArgs infixes = prettySe (ppopt_depth ppo) startPrec bnd
18901916 bracket p funcAppPrec . group . align . hang 2 $
18911917 text "%runElab" <$>
18921918 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
18941920
18951921 prettySe d p bnd _ = text "missing pretty-printer for term"
18961922
@@ -2137,7 +2163,7 @@ showTm ist = displayDecorated (consoleDecorate ist) .
21372163showTmImpls :: PTerm -> String
21382164showTmImpls = flip (displayS . renderCompact . prettyImp verbosePPOption) ""
21392165
2140−-- | Show a term with specific options
2166+-- | Show a term with specific options
21412167showTmOpts :: PPOption -> PTerm -> String
21422168showTmOpts opt = flip (displayS . renderPretty 1.0 10000000 . prettyImp opt) ""
21432169
@@ -2253,7 +2279,7 @@ boundNamesIn tm = S.toList (ni 0 S.empty tm)
22532279
22542280-- Return names which are valid implicits in the given term (type).
22552281implicitNamesIn :: [Name] -> IState -> PTerm -> [Name]
2256−implicitNamesIn uvars ist tm
2282+implicitNamesIn uvars ist tm
22572283 = let (imps, fns) = execState (ni 0 [] tm) ([], []) in
22582284 nub imps \\ nub fns
22592285 where
@@ -2282,15 +2308,15 @@ implicitNamesIn uvars ist tm
22822308 ni 0 env (PRef _ _ n)
22832309 | not (n `elem` env) && implicitable n || n `elem` uvars = addImp n
22842310 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
22862312 mapM_ (ni 0 env) (map getTm as)
22872313 | otherwise = do case lookupTy n (tt_ctxt ist) of
22882314 [] -> return ()
22892315 _ -> addFn n
22902316 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
22922318 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
22942320 mapM_ (ni 0 env) (map getTm as)
22952321 ni 0 env (PCase _ c os) = do ni 0 env c
22962322 -- names in 'os', not counting the names bound in the cases
@@ -2307,7 +2333,7 @@ implicitNamesIn uvars ist tm
23072333 ni 0 env (PTyped l r) = do ni 0 env l; ni 0 env r
23082334 ni 0 env (PPair _ _ _ l r) = do ni 0 env l; ni 0 env r
23092335 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
23112337 ni 0 env t
23122338 ni 0 env r
23132339 ni 0 env (PAlternative ns a as) = mapM_ (ni 0 env) as