@@ -84,7 +84,7 @@ elabClauses info' fc opts n_in cs =
84 -- no simplification or PE
84 -- no simplification or PE
85 let (pats_in, cs_full) = unzip cs_elab
85 let (pats_in, cs_full) = unzip cs_elab
86 let pats_raw = map (simple_lhs (tt_ctxt ist)) pats_in
86 let pats_raw = map (simple_lhs (tt_ctxt ist)) pats_in
87− logLvl 3 $ "Elaborated patterns:\n" ++ show pats_raw
87+ logElab 3 $ "Elaborated patterns:\n" ++ show pats_raw
89 solveDeferred n
89 solveDeferred n
@@ -102,7 +102,7 @@ elabClauses info' fc opts n_in cs =
102 -- If the definition is specialisable, this reduces the
102 -- If the definition is specialisable, this reduces the
104 pe_tm <- doPartialEval ist tpats
104 pe_tm <- doPartialEval ist tpats
105− let pats_pe = if petrans
105+ let pats_pe = if petrans
106 then map (simple_lhs (tt_ctxt ist)) pe_tm
106 then map (simple_lhs (tt_ctxt ist)) pe_tm
107 else pats_raw
107 else pats_raw
@@ -111,7 +111,7 @@ elabClauses info' fc opts n_in cs =
111 -- Look for 'static' names and generate new specialised
111 -- Look for 'static' names and generate new specialised
112 -- definitions for them, as well as generating rewrite rules
112 -- definitions for them, as well as generating rewrite rules
113 -- for partially evaluated definitions
113 -- for partially evaluated definitions
114− newrules <- if petrans
114+ newrules <- if petrans
115 then mapM (\ e -> case e of
115 then mapM (\ e -> case e of
116 Left _ -> return []
116 Left _ -> return []
117 Right (l, r) -> elabPE info fc n r) pats_pe
117 Right (l, r) -> elabPE info fc n r) pats_pe
@@ -134,12 +134,12 @@ elabClauses info' fc opts n_in cs =
134 -- pdef is the compile-time pattern definition.
134 -- pdef is the compile-time pattern definition.
135 -- This will get further inlined to help with totality checking.
135 -- This will get further inlined to help with totality checking.
136 let pdef = map (\(ns, lhs, rhs) -> (map fst ns, lhs, rhs)) $ map debind pats_raw
136 let pdef = map (\(ns, lhs, rhs) -> (map fst ns, lhs, rhs)) $ map debind pats_raw
137− -- pdef_pe is the one which will get further optimised
137+ -- pdef_pe is the one which will get further optimised
138 -- for run-time, and, partially evaluated
138 -- for run-time, and, partially evaluated
139 let pdef_pe = map debind pats_transformed
139 let pdef_pe = map debind pats_transformed
141− logLvl 5 $ "Initial typechecked patterns:\n" ++ show pats_raw
141+ logElab 5 $ "Initial typechecked patterns:\n" ++ show pats_raw
142− logLvl 5 $ "Initial typechecked pattern def:\n" ++ show pdef
142+ logElab 5 $ "Initial typechecked pattern def:\n" ++ show pdef
144 -- NOTE: Need to store original definition so that proofs which
144 -- NOTE: Need to store original definition so that proofs which
145 -- rely on its structure aren't affected by any changes to the
145 -- rely on its structure aren't affected by any changes to the
@@ -152,10 +152,10 @@ elabClauses info' fc opts n_in cs =
152 numArgs <- tclift $ sameLength pdef
152 numArgs <- tclift $ sameLength pdef
154 case specNames opts of
154 case specNames opts of
155− Just _ ->
155+ Just _ ->
156− do logLvl 3 $ "Partially evaluated:\n" ++ show pats_pe
156+ do logElab 3 $ "Partially evaluated:\n" ++ show pats_pe
157 _ -> return ()
157 _ -> return ()
158− logLvl 3 $ "Transformed:\n" ++ show pats_transformed
158+ logElab 3 $ "Transformed:\n" ++ show pats_transformed
160 erInfo <- getErasureInfo <$> getIState
160 erInfo <- getErasureInfo <$> getIState
161 tree@(CaseDef scargs sc _) <- tclift $
161 tree@(CaseDef scargs sc _) <- tclift $
@@ -167,7 +167,7 @@ elabClauses info' fc opts n_in cs =
167 -- missing <- genMissing n scargs sc
167 -- missing <- genMissing n scargs sc
168 missing' <- filterM (checkPossible info fc True n) missing
168 missing' <- filterM (checkPossible info fc True n) missing
169 let clhs = map getLHS pdef
169 let clhs = map getLHS pdef
170− logLvl 2 $ "Must be unreachable:\n" ++
170+ logElab 2 $ "Must be unreachable:\n" ++
171 showSep "\n" (map showTmImpls missing') ++
171 showSep "\n" (map showTmImpls missing') ++
172 "\nAgainst: " ++
172 "\nAgainst: " ++
173 showSep "\n" (map (\t -> showTmImpls (delab ist t)) (map getLHS pdef))
173 showSep "\n" (map (\t -> showTmImpls (delab ist t)) (map getLHS pdef))
@@ -185,12 +185,12 @@ elabClauses info' fc opts n_in cs =
185 pdef_in' <- applyOpts $ map (\(ns, lhs, rhs) -> (map fst ns, lhs, rhs)) pdef_pe
185 pdef_in' <- applyOpts $ map (\(ns, lhs, rhs) -> (map fst ns, lhs, rhs)) pdef_pe
186 let pdef' = map (simple_rt (tt_ctxt ist)) pdef_in'
186 let pdef' = map (simple_rt (tt_ctxt ist)) pdef_in'
188− logLvl 5 $ "After data structure transformations:\n" ++ show pdef'
188+ logElab 5 $ "After data structure transformations:\n" ++ show pdef'
190 ist <- getIState
190 ist <- getIState
191 -- let wf = wellFounded ist n sc
191 -- let wf = wellFounded ist n sc
192 let tot | pcover || AssertTotal `elem` opts = Unchecked -- finish later
192 let tot | pcover || AssertTotal `elem` opts = Unchecked -- finish later
193− | PEGenerated `elem` opts = Generated
193+ | PEGenerated `elem` opts = Generated
194 | otherwise = Partial NotCovering -- already know it's not total
194 | otherwise = Partial NotCovering -- already know it's not total
196 -- case lookupCtxt (namespace info) n (idris_flags ist) of
196 -- case lookupCtxt (namespace info) n (idris_flags ist) of
@@ -206,17 +206,17 @@ elabClauses info' fc opts n_in cs =
206 ":warning - Unreachable case: " ++
206 ":warning - Unreachable case: " ++
207 show (delab ist x)) xs
207 show (delab ist x)) xs
208 let knowncovering = (pcover && cov) || AssertTotal `elem` opts
208 let knowncovering = (pcover && cov) || AssertTotal `elem` opts
209− let defaultcase = if knowncovering
209+ let defaultcase = if knowncovering
210 then STerm Erased
210 then STerm Erased
211− else UnmatchedCase $ "*** " ++
211+ else UnmatchedCase $ "*** " ++
212− show fc ++
212+ show fc ++
213− ":unmatched case in " ++ show n ++
213+ ":unmatched case in " ++ show n ++
216 tree' <- tclift $ simpleCase tcase defaultcase reflect
216 tree' <- tclift $ simpleCase tcase defaultcase reflect
217 RunTime fc inacc atys pdef' erInfo
217 RunTime fc inacc atys pdef' erInfo
218− logLvl 3 $ "Unoptimised " ++ show n ++ ": " ++ show tree
218+ logElab 3 $ "Unoptimised " ++ show n ++ ": " ++ show tree
219− logLvl 3 $ "Optimised: " ++ show tree'
219+ logElab 3 $ "Optimised: " ++ show tree'
220 ctxt <- getContext
220 ctxt <- getContext
221 ist <- getIState
221 ist <- getIState
222 let opt = idris_optimisation ist
222 let opt = idris_optimisation ist
@@ -224,7 +224,7 @@ elabClauses info' fc opts n_in cs =
224 (idris_patdefs ist) })
224 (idris_patdefs ist) })
225 let caseInfo = CaseInfo (inlinable opts) (inlinable opts) (dictionary opts)
225 let caseInfo = CaseInfo (inlinable opts) (inlinable opts) (dictionary opts)
226 case lookupTyExact n ctxt of
226 case lookupTyExact n ctxt of
227− Just ty ->
227+ Just ty ->
228 do ctxt' <- do ctxt <- getContext
228 do ctxt' <- do ctxt <- getContext
230 addCasedef n erInfo caseInfo
230 addCasedef n erInfo caseInfo
@@ -242,7 +242,7 @@ elabClauses info' fc opts n_in cs =
242 setContext ctxt'
242 setContext ctxt'
243 addIBC (IBCDef n)
243 addIBC (IBCDef n)
244 setTotality n tot
244 setTotality n tot
245− when (not reflect && PEGenerated `notElem` opts) $
245+ when (not reflect && PEGenerated `notElem` opts) $
246 do totcheck (fc, n)
246 do totcheck (fc, n)
247 defer_totcheck (fc, n)
247 defer_totcheck (fc, n)
248 when (tot /= Unchecked) $ addIBC (IBCTotal n tot)
248 when (tot /= Unchecked) $ addIBC (IBCTotal n tot)
@@ -256,7 +256,7 @@ elabClauses info' fc opts n_in cs =
256 -- let scg = buildSCG i sc scargs
256 -- let scg = buildSCG i sc scargs
257 -- add SCG later, when checking totality
257 -- add SCG later, when checking totality
258 let cg = CGInfo scargs' calls [] used [] -- TODO: remove this, not needed anymore
258 let cg = CGInfo scargs' calls [] used [] -- TODO: remove this, not needed anymore
259− logLvl 2 $ "Called names: " ++ show cg
259+ logElab 2 $ "Called names: " ++ show cg
260 addToCG n cg
260 addToCG n cg
261 addToCalledG n (nub (map fst calls)) -- plus names in type!
261 addToCalledG n (nub (map fst calls)) -- plus names in type!
262 addIBC (IBCCG n)
262 addIBC (IBCCG n)
@@ -360,7 +360,7 @@ elabPE info fc caller r =
360 let undef = case lookupDefExact newnm (tt_ctxt ist) of
360 let undef = case lookupDefExact newnm (tt_ctxt ist) of
361 Nothing -> True
361 Nothing -> True
362 _ -> False
362 _ -> False
363− logLvl 5 $ show (newnm, undef, map (concreteArg ist) (snd specapp))
363+ logElab 5 $ show (newnm, undef, map (concreteArg ist) (snd specapp))
364 idrisCatch
364 idrisCatch
365 (if (undef && all (concreteArg ist) (snd specapp)) then do
365 (if (undef && all (concreteArg ist) (snd specapp)) then do
366 cgns <- getAllNames n
366 cgns <- getAllNames n
@@ -374,32 +374,32 @@ elabPE info fc caller r =
374 [Total _] -> 65536
374 [Total _] -> 65536
375 [Productive] -> 16
375 [Productive] -> 16
377− let opts = [Specialise ((if pe_simple specdecl
377+ let opts = [Specialise ((if pe_simple specdecl
378− then map (\x -> (x, Nothing)) cgns'
378+ then map (\x -> (x, Nothing)) cgns'
379 else []) ++
379 else []) ++
380− (n, Just maxred) :
380+ (n, Just maxred) :
381 mapMaybe (specName (pe_simple specdecl))
381 mapMaybe (specName (pe_simple specdecl))
382 (snd specapp))]
382 (snd specapp))]
383− logLvl 3 $ "Specialising application: " ++ show specapp
383+ logElab 3 $ "Specialising application: " ++ show specapp
384 ++ " in " ++ show caller ++
384 ++ " in " ++ show caller ++
385 " with " ++ show opts
385 " with " ++ show opts
386− logLvl 3 $ "New name: " ++ show newnm
386+ logElab 3 $ "New name: " ++ show newnm
387− logLvl 3 $ "PE definition type : " ++ (show specTy)
387+ logElab 3 $ "PE definition type : " ++ (show specTy)
388 ++ "\n" ++ show opts
388 ++ "\n" ++ show opts
389− logLvl 3 $ "PE definition " ++ show newnm ++ ":\n" ++
389+ logElab 3 $ "PE definition " ++ show newnm ++ ":\n" ++
390 showSep "\n"
390 showSep "\n"
391 (map (\ (lhs, rhs) ->
391 (map (\ (lhs, rhs) ->
392 (showTmImpls lhs ++ " = " ++
392 (showTmImpls lhs ++ " = " ++
393 showTmImpls rhs)) (pe_clauses specdecl))
393 showTmImpls rhs)) (pe_clauses specdecl))
395− logLvl 2 $ show n ++ " transformation rule: " ++
395+ logElab 2 $ show n ++ " transformation rule: " ++
396 showTmImpls rhs ++ " ==> " ++ showTmImpls lhs
396 showTmImpls rhs ++ " ==> " ++ showTmImpls lhs
398 elabType info defaultSyntax emptyDocstring [] fc opts newnm NoFC specTy
398 elabType info defaultSyntax emptyDocstring [] fc opts newnm NoFC specTy
399 let def = map (\(lhs, rhs) ->
399 let def = map (\(lhs, rhs) ->
400 let lhs' = mapPT hiddenToPH $ stripUnmatchable ist lhs in
400 let lhs' = mapPT hiddenToPH $ stripUnmatchable ist lhs in
401− PClause fc newnm lhs' [] rhs [])
401+ PClause fc newnm lhs' [] rhs [])
402− (pe_clauses specdecl)
402+ (pe_clauses specdecl)
403 trans <- elabTransform info fc False rhs lhs
403 trans <- elabTransform info fc False rhs lhs
404 elabClauses info fc (PEGenerated:opts) newnm def
404 elabClauses info fc (PEGenerated:opts) newnm def
405 return [trans]
405 return [trans]
@@ -407,7 +407,7 @@ elabPE info fc caller r =
407 -- if it doesn't work, just don't specialise. Could happen for lots
407 -- if it doesn't work, just don't specialise. Could happen for lots
408 -- of valid reasons (e.g. local variables in scope which can't be
408 -- of valid reasons (e.g. local variables in scope which can't be
409 -- lifted out).
409 -- lifted out).
410− (\e -> do logLvl 3 $ "Couldn't specialise: " ++ (pshow ist e)
410+ (\e -> do logElab 3 $ "Couldn't specialise: " ++ (pshow ist e)
411 return [])
411 return [])
413 hiddenToPH (PHidden _) = Placeholder
413 hiddenToPH (PHidden _) = Placeholder
@@ -450,7 +450,7 @@ elabPE info fc caller r =
450 -- get the clause of a specialised application
450 -- get the clause of a specialised application
451 getSpecClause ist (n, args)
451 getSpecClause ist (n, args)
452 = let newnm = sUN ("PE_" ++ show (nsroot n) ++ "_" ++
452 = let newnm = sUN ("PE_" ++ show (nsroot n) ++ "_" ++
453− qhash 5381 (showSep "_" (map showArg args))) in
453+ qhash 5381 (showSep "_" (map showArg args))) in
454 -- UN (show n ++ show (map snd args)) in
454 -- UN (show n ++ show (map snd args)) in
455 (n, newnm, mkPE_TermDecl ist newnm n args)
455 (n, newnm, mkPE_TermDecl ist newnm n args)
456 where showArg (ExplicitS, n) = qshow n
456 where showArg (ExplicitS, n) = qshow n
@@ -477,7 +477,7 @@ checkPossible info fc tcgen fname lhs_in
477 let lhs = addImplPat i lhs_in
477 let lhs = addImplPat i lhs_in
478 -- if the LHS type checks, it is possible
478 -- if the LHS type checks, it is possible
479 case elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
479 case elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
480− (erun fc (buildTC i info ELHS [] fname
480+ (erun fc (buildTC i info ELHS [] fname
481 (allNamesIn lhs_in)
481 (allNamesIn lhs_in)
482 (infTerm lhs))) of
482 (infTerm lhs))) of
483 OK (ElabResult lhs' _ _ ctxt' newDecls highlights, _) ->
483 OK (ElabResult lhs' _ _ ctxt' newDecls highlights, _) ->
@@ -570,17 +570,17 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
571 let lhs = mkLHSapp $ stripLinear i $ stripUnmatchable i $
571 let lhs = mkLHSapp $ stripLinear i $ stripUnmatchable i $
572 propagateParams i params norm_ty (allNamesIn lhs_in) (addImplPat i lhs_in)
572 propagateParams i params norm_ty (allNamesIn lhs_in) (addImplPat i lhs_in)
573−-- let lhs = mkLHSapp $
573+-- let lhs = mkLHSapp $
574-- propagateParams i params fn_ty (addImplPat i lhs_in)
574-- propagateParams i params fn_ty (addImplPat i lhs_in)
575− logLvl 10 (show (params, fn_ty) ++ " " ++ showTmImpls (addImplPat i lhs_in))
575+ logElab 10 (show (params, fn_ty) ++ " " ++ showTmImpls (addImplPat i lhs_in))
576− logLvl 5 ("LHS: " ++ show fc ++ " " ++ showTmImpls lhs)
576+ logElab 5 ("LHS: " ++ show fc ++ " " ++ showTmImpls lhs)
577− logLvl 4 ("Fixed parameters: " ++ show params ++ " from " ++ show lhs_in ++
577+ logElab 4 ("Fixed parameters: " ++ show params ++ " from " ++ show lhs_in ++
578 "\n" ++ show (fn_ty, fn_is))
578 "\n" ++ show (fn_ty, fn_is))
580 ((ElabResult lhs' dlhs [] ctxt' newDecls highlights, probs, inj), _) <-
580 ((ElabResult lhs' dlhs [] ctxt' newDecls highlights, probs, inj), _) <-
581 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
581 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
582 (do res <- errAt "left hand side of " fname Nothing
582 (do res <- errAt "left hand side of " fname Nothing
583− (erun fc (buildTC i info ELHS opts fname
583+ (erun fc (buildTC i info ELHS opts fname
584 (allNamesIn lhs_in)
584 (allNamesIn lhs_in)
585 (infTerm lhs)))
585 (infTerm lhs)))
586 probs <- get_probs
586 probs <- get_probs
@@ -589,16 +589,16 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
589 setContext ctxt'
589 setContext ctxt'
590 processTacticDecls info newDecls
590 processTacticDecls info newDecls
591 sendHighlighting highlights
591 sendHighlighting highlights
593 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
593 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
595 let lhs_tm = orderPats (getInferTerm lhs')
595 let lhs_tm = orderPats (getInferTerm lhs')
596 let lhs_ty = getInferType lhs'
596 let lhs_ty = getInferType lhs'
597 let static_names = getStaticNames i lhs_tm
597 let static_names = getStaticNames i lhs_tm
599− logLvl 3 ("Elaborated: " ++ show lhs_tm)
599+ logElab 3 ("Elaborated: " ++ show lhs_tm)
600− logLvl 3 ("Elaborated type: " ++ show lhs_ty)
600+ logElab 3 ("Elaborated type: " ++ show lhs_ty)
601− logLvl 5 ("Injective: " ++ show fname ++ " " ++ show inj)
601+ logElab 5 ("Injective: " ++ show fname ++ " " ++ show inj)
603 -- If we're inferring metavariables in the type, don't recheck,
603 -- If we're inferring metavariables in the type, don't recheck,
604 -- because we're only doing this to try to work out those metavariables
604 -- because we're only doing this to try to work out those metavariables
@@ -615,16 +615,16 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
615 -- Issue #1615 on the Issue Tracker.
615 -- Issue #1615 on the Issue Tracker.
616 -- https://github.com/idris-lang/Idris-dev/issues/1615
616 -- https://github.com/idris-lang/Idris-dev/issues/1615
617 when (not (null borrowed)) $
617 when (not (null borrowed)) $
618− logLvl 5 ("Borrowed names on LHS: " ++ show borrowed)
618+ logElab 5 ("Borrowed names on LHS: " ++ show borrowed)
620− logLvl 3 ("Normalised LHS: " ++ showTmImpls (delabMV i clhs))
620+ logElab 3 ("Normalised LHS: " ++ showTmImpls (delabMV i clhs))
622 rep <- useREPL
622 rep <- useREPL
623 when rep $ do
623 when rep $ do
624 addInternalApp (fc_fname fc) (fst . fc_start $ fc) (delabMV i clhs) -- TODO: Should use span instead of line and filename?
624 addInternalApp (fc_fname fc) (fst . fc_start $ fc) (delabMV i clhs) -- TODO: Should use span instead of line and filename?
625 addIBC (IBCLineApp (fc_fname fc) (fst . fc_start $ fc) (delabMV i clhs))
625 addIBC (IBCLineApp (fc_fname fc) (fst . fc_start $ fc) (delabMV i clhs))
627− logLvl 5 ("Checked " ++ show clhs ++ "\n" ++ show clhsty)
627+ logElab 5 ("Checked " ++ show clhs ++ "\n" ++ show clhsty)
628 -- Elaborate where block
628 -- Elaborate where block
629 ist <- getIState
629 ist <- getIState
630 windex <- getName
630 windex <- getName
@@ -647,16 +647,16 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
647 -- Elaborate those with a type *before* RHS, those without *after*
647 -- Elaborate those with a type *before* RHS, those without *after*
648 let (wbefore, wafter) = sepBlocks wb
648 let (wbefore, wafter) = sepBlocks wb
650− logLvl 2 $ "Where block:\n " ++ show wbefore ++ "\n" ++ show wafter
650+ logElab 2 $ "Where block:\n " ++ show wbefore ++ "\n" ++ show wafter
651 mapM_ (rec_elabDecl info EAll winfo) wbefore
651 mapM_ (rec_elabDecl info EAll winfo) wbefore
652 -- Now build the RHS, using the type of the LHS as the goal.
652 -- Now build the RHS, using the type of the LHS as the goal.
653 i <- getIState -- new implicits from where block
653 i <- getIState -- new implicits from where block
654− logLvl 5 (showTmImpls (expandParams decorate newargs defs (defs \\ decls) rhs_in))
654+ logElab 5 (showTmImpls (expandParams decorate newargs defs (defs \\ decls) rhs_in))
655 let rhs = addImplBoundInf i (map fst newargs_all) (defs \\ decls)
655 let rhs = addImplBoundInf i (map fst newargs_all) (defs \\ decls)
656 (expandParams decorate newargs defs (defs \\ decls) rhs_in)
656 (expandParams decorate newargs defs (defs \\ decls) rhs_in)
657− logLvl 2 $ "RHS: " ++ show (map fst newargs_all) ++ " " ++ showTmImpls rhs
657+ logElab 2 $ "RHS: " ++ show (map fst newargs_all) ++ " " ++ showTmImpls rhs
658 ctxt <- getContext -- new context with where block added
658 ctxt <- getContext -- new context with where block added
659− logLvl 5 "STARTING CHECK"
659+ logElab 5 "STARTING CHECK"
660 ((rhs', defer, is, probs, ctxt', newDecls, highlights), _) <-
660 ((rhs', defer, is, probs, ctxt', newDecls, highlights), _) <-
661 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patRHS") clhsty initEState
661 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patRHS") clhsty initEState
662 (do pbinds ist lhs_tm
662 (do pbinds ist lhs_tm
@@ -671,7 +671,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
671 (erun fc $ psolve lhs_tm)
671 (erun fc $ psolve lhs_tm)
672 tt <- get_term
672 tt <- get_term
673 aux <- getAux
673 aux <- getAux
674− let (tm, ds) = runState (collectDeferred (Just fname)
674+ let (tm, ds) = runState (collectDeferred (Just fname)
675 (map fst $ case_decls aux) ctxt tt) []
675 (map fst $ case_decls aux) ctxt tt) []
676 probs <- get_probs
676 probs <- get_probs
677 return (tm, ds, is, probs, ctxt', newDecls, highlights))
677 return (tm, ds, is, probs, ctxt', newDecls, highlights))
@@ -681,9 +681,9 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
682 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
682 when inf $ addTyInfConstraints fc (map (\(x,y,_,_,_,_,_) -> (x,y)) probs)
684− logLvl 5 "DONE CHECK"
684+ logElab 5 "DONE CHECK"
685− logLvl 4 $ "---> " ++ show rhs'
685+ logElab 4 $ "---> " ++ show rhs'
686− when (not (null defer)) $ logLvl 1 $ "DEFERRED " ++
686+ when (not (null defer)) $ logElab 1 $ "DEFERRED " ++
687 show (map (\ (n, (_,_,t,_)) -> (n, t)) defer)
687 show (map (\ (n, (_,_,t,_)) -> (n, t)) defer)
688 def' <- checkDef fc (\n -> Elaborating "deferred type of " n Nothing) defer
688 def' <- checkDef fc (\n -> Elaborating "deferred type of " n Nothing) defer
689 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False))) def'
689 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False))) def'
@@ -700,20 +700,20 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
700 mapM_ (elabCaseBlock winfo opts) is
700 mapM_ (elabCaseBlock winfo opts) is
702 ctxt <- getContext
702 ctxt <- getContext
703− logLvl 5 $ "Rechecking"
703+ logElab 5 $ "Rechecking"
704− logLvl 6 $ " ==> " ++ show (forget rhs')
704+ logElab 6 $ " ==> " ++ show (forget rhs')
706 (crhs, crhsty) <- if not inf
706 (crhs, crhsty) <- if not inf
707 then recheckC_borrowing True (PEGenerated `notElem` opts)
707 then recheckC_borrowing True (PEGenerated `notElem` opts)
708 borrowed fc id [] rhs'
708 borrowed fc id [] rhs'
709 else return (rhs', clhsty)
709 else return (rhs', clhsty)
710− logLvl 6 $ " ==> " ++ showEnvDbg [] crhsty ++ " against " ++ showEnvDbg [] clhsty
710+ logElab 6 $ " ==> " ++ showEnvDbg [] crhsty ++ " against " ++ showEnvDbg [] clhsty
711 ctxt <- getContext
711 ctxt <- getContext
712 let constv = next_tvar ctxt
712 let constv = next_tvar ctxt
713 case LState.runStateT (convertsC ctxt [] crhsty clhsty) (constv, []) of
713 case LState.runStateT (convertsC ctxt [] crhsty clhsty) (constv, []) of
714 OK (_, cs) -> when (PEGenerated `notElem` opts) $ do
714 OK (_, cs) -> when (PEGenerated `notElem` opts) $ do
715− addConstraints fc cs
715+ addConstraints fc cs
716− logLvl 6 $ "CONSTRAINTS ADDED: " ++ show cs ++ "\n" ++ show (clhsty, crhsty)
716+ logElab 6 $ "CONSTRAINTS ADDED: " ++ show cs ++ "\n" ++ show (clhsty, crhsty)
717 return ()
717 return ()
718 Error e -> ierror (At fc (CantUnify False (clhsty, Nothing) (crhsty, Nothing) e [] 0))
718 Error e -> ierror (At fc (CantUnify False (clhsty, Nothing) (crhsty, Nothing) e [] 0))
719 i <- getIState
719 i <- getIState
@@ -805,14 +805,14 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
807 let params = getParamsInType i [] fn_is (normalise ctxt [] fn_ty)
807 let params = getParamsInType i [] fn_is (normalise ctxt [] fn_ty)
808− let lhs = stripLinear i $ stripUnmatchable i $
808+ let lhs = stripLinear i $ stripUnmatchable i $
809− propagateParams i params fn_ty (allNamesIn lhs_in)
809+ propagateParams i params fn_ty (allNamesIn lhs_in)
810 (addImplPat i lhs_in)
810 (addImplPat i lhs_in)
811− logLvl 2 ("LHS: " ++ show lhs)
811+ logElab 2 ("LHS: " ++ show lhs)
812 (ElabResult lhs' dlhs [] ctxt' newDecls highlights, _) <-
812 (ElabResult lhs' dlhs [] ctxt' newDecls highlights, _) <-
813 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
813 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "patLHS") infP initEState
814 (errAt "left hand side of with in " fname Nothing
814 (errAt "left hand side of with in " fname Nothing
815− (erun fc (buildTC i info ELHS opts fname
815+ (erun fc (buildTC i info ELHS opts fname
816 (allNamesIn lhs_in)
816 (allNamesIn lhs_in)
817 (infTerm lhs))) )
817 (infTerm lhs))) )
818 setContext ctxt'
818 setContext ctxt'
@@ -823,12 +823,12 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
823 let lhs_ty = getInferType lhs'
823 let lhs_ty = getInferType lhs'
824 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
824 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
825 let static_names = getStaticNames i lhs_tm
825 let static_names = getStaticNames i lhs_tm
826− logLvl 5 (show lhs_tm ++ "\n" ++ show static_names)
826+ logElab 5 (show lhs_tm ++ "\n" ++ show static_names)
827 (clhs, clhsty) <- recheckC fc id [] lhs_tm
827 (clhs, clhsty) <- recheckC fc id [] lhs_tm
828− logLvl 5 ("Checked " ++ show clhs)
828+ logElab 5 ("Checked " ++ show clhs)
829 let bargs = getPBtys (explicitNames (normalise ctxt [] lhs_tm))
829 let bargs = getPBtys (explicitNames (normalise ctxt [] lhs_tm))
830 let wval = addImplBound i (map fst bargs) wval_in
830 let wval = addImplBound i (map fst bargs) wval_in
831− logLvl 5 ("Checking " ++ showTmImpls wval)
831+ logElab 5 ("Checking " ++ showTmImpls wval)
832 -- Elaborate wval in this context
832 -- Elaborate wval in this context
833 ((wval', defer, is, ctxt', newDecls, highlights), _) <-
833 ((wval', defer, is, ctxt', newDecls, highlights), _) <-
834 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "withRHS")
834 tclift $ elaborate ctxt (idris_datatypes i) (sMN 0 "withRHS")
@@ -851,11 +851,11 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
851 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False))) def'
851 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False))) def'
852 addDeferred def''
852 addDeferred def''
853 mapM_ (elabCaseBlock info opts) is
853 mapM_ (elabCaseBlock info opts) is
854− logLvl 5 ("Checked wval " ++ show wval')
854+ logElab 5 ("Checked wval " ++ show wval')
855 (cwval, cwvalty) <- recheckC fc id [] (getInferTerm wval')
855 (cwval, cwvalty) <- recheckC fc id [] (getInferTerm wval')
856 let cwvaltyN = explicitNames (normalise ctxt [] cwvalty)
856 let cwvaltyN = explicitNames (normalise ctxt [] cwvalty)
857 let cwvalN = explicitNames (normalise ctxt [] cwval)
857 let cwvalN = explicitNames (normalise ctxt [] cwval)
858− logLvl 3 ("With type " ++ show cwvalty ++ "\nRet type " ++ show ret_ty)
858+ logElab 3 ("With type " ++ show cwvalty ++ "\nRet type " ++ show ret_ty)
859 -- We're going to assume the with type is not a function shortly,
859 -- We're going to assume the with type is not a function shortly,
860 -- so report an error if it is (you can't match on a function anyway
860 -- so report an error if it is (you can't match on a function anyway
861 -- so this doesn't lose anything)
861 -- so this doesn't lose anything)
@@ -876,9 +876,9 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
876 -- Highlight explicit proofs
876 -- Highlight explicit proofs
877 sendHighlighting $ [(fc, AnnBoundName n False) | (n, fc) <- maybeToList pn_in]
877 sendHighlighting $ [(fc, AnnBoundName n False) | (n, fc) <- maybeToList pn_in]
879− logLvl 10 ("With type " ++ show (getRetTy cwvaltyN) ++
879+ logElab 10 ("With type " ++ show (getRetTy cwvaltyN) ++
880 " depends on " ++ show pdeps ++ " from " ++ show pvars)
880 " depends on " ++ show pdeps ++ " from " ++ show pvars)
881− logLvl 10 ("Pre " ++ show bargs_pre ++ "\nPost " ++ show bargs_post)
881+ logElab 10 ("Pre " ++ show bargs_pre ++ "\nPost " ++ show bargs_post)
882 windex <- getName
882 windex <- getName
883 -- build a type declaration for the new function:
883 -- build a type declaration for the new function:
884 -- (ps : Xs) -> (withval : cwvalty) -> (ps' : Xs') -> ret_ty
884 -- (ps : Xs) -> (withval : cwvalty) -> (ps' : Xs') -> ret_ty
@@ -886,7 +886,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
886 let wargtype = getRetTy cwvaltyN
886 let wargtype = getRetTy cwvaltyN
887 let wargname = sMN windex "warg"
887 let wargname = sMN windex "warg"
889− logLvl 5 ("Abstract over " ++ show wargval ++ " in " ++ show wargtype)
889+ logElab 5 ("Abstract over " ++ show wargval ++ " in " ++ show wargtype)
890 let wtype = bindTyArgs (flip (Pi Nothing) (TType (UVar 0))) (bargs_pre ++
890 let wtype = bindTyArgs (flip (Pi Nothing) (TType (UVar 0))) (bargs_pre ++
891 (wargname, wargtype) :
891 (wargname, wargtype) :
892 map (abstract wargname wargval wargtype) bargs_post ++
892 map (abstract wargname wargval wargtype) bargs_post ++
@@ -896,13 +896,13 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
896 P Bound wargname Erased, wargval])]
896 P Bound wargname Erased, wargval])]
897 Nothing -> [])
897 Nothing -> [])
898 (substTerm wargval (P Bound wargname wargtype) ret_ty)
898 (substTerm wargval (P Bound wargname wargtype) ret_ty)
899− logLvl 3 ("New function type " ++ show wtype)
899+ logElab 3 ("New function type " ++ show wtype)
900 let wname = SN (WithN windex fname)
900 let wname = SN (WithN windex fname)
902 let imps = getImps wtype -- add to implicits context
902 let imps = getImps wtype -- add to implicits context
903 putIState (i { idris_implicits = addDef wname imps (idris_implicits i) })
903 putIState (i { idris_implicits = addDef wname imps (idris_implicits i) })
904 let statics = getStatics static_names wtype
904 let statics = getStatics static_names wtype
905− logLvl 5 ("Static positions " ++ show statics)
905+ logElab 5 ("Static positions " ++ show statics)
906 i <- getIState
906 i <- getIState
907 putIState (i { idris_statics = addDef wname statics (idris_statics i) })
907 putIState (i { idris_statics = addDef wname statics (idris_statics i) })
@@ -919,7 +919,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
919 -- ==> fname' ps wpat [rest], match pats against toplevel for ps
919 -- ==> fname' ps wpat [rest], match pats against toplevel for ps
920 wb <- mapM (mkAuxC mpn wname lhs (map fst bargs_pre) (map fst bargs_post))
920 wb <- mapM (mkAuxC mpn wname lhs (map fst bargs_pre) (map fst bargs_post))
921 withblock
921 withblock
922− logLvl 3 ("with block " ++ show wb)
922+ logElab 3 ("with block " ++ show wb)
923 -- propagate totality assertion to the new definitions
923 -- propagate totality assertion to the new definitions
924 when (AssertTotal `elem` opts) $ setFlags wname [AssertTotal]
924 when (AssertTotal `elem` opts) $ setFlags wname [AssertTotal]
925 mapM_ (rec_elabDecl info EAll info) wb
925 mapM_ (rec_elabDecl info EAll info) wb
@@ -935,7 +935,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
935 [ pimp (sUN "A") Placeholder False
935 [ pimp (sUN "A") Placeholder False
936 , pimp (sUN "x") Placeholder False
936 , pimp (sUN "x") Placeholder False
938− logLvl 5 ("New RHS " ++ showTmImpls rhs)
938+ logElab 5 ("New RHS " ++ showTmImpls rhs)
939 ctxt <- getContext -- New context with block added
939 ctxt <- getContext -- New context with block added
940 i <- getIState
940 i <- getIState
941 ((rhs', defer, is, ctxt', newDecls, highlights), _) <-
941 ((rhs', defer, is, ctxt', newDecls, highlights), _) <-
@@ -955,7 +955,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
955 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False))) def'
955 let def'' = map (\(n, (i, top, t, ns)) -> (n, (i, top, t, ns, False))) def'
956 addDeferred def''
956 addDeferred def''
957 mapM_ (elabCaseBlock info opts) is
957 mapM_ (elabCaseBlock info opts) is
958− logLvl 5 ("Checked RHS " ++ show rhs')
958+ logElab 5 ("Checked RHS " ++ show rhs')
959 (crhs, crhsty) <- recheckC fc id [] rhs'
959 (crhs, crhsty) <- recheckC fc id [] rhs'
960 return $ (Right (clhs, crhs), lhs)
960 return $ (Right (clhs, crhs), lhs)
@@ -971,18 +971,18 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
971 mkAux pn wname toplhs ns ns' (PClause fc n tm_in (w:ws) rhs wheres)
971 mkAux pn wname toplhs ns ns' (PClause fc n tm_in (w:ws) rhs wheres)
972 = do i <- getIState
972 = do i <- getIState
973 let tm = addImplPat i tm_in
973 let tm = addImplPat i tm_in
974− logLvl 2 ("Matching " ++ showTmImpls tm ++ " against " ++
974+ logElab 2 ("Matching " ++ showTmImpls tm ++ " against " ++
975 showTmImpls toplhs)
975 showTmImpls toplhs)
976 case matchClause i toplhs tm of
976 case matchClause i toplhs tm of
977 Left (a,b) -> ifail $ show fc ++ ":with clause does not match top level"
977 Left (a,b) -> ifail $ show fc ++ ":with clause does not match top level"
978 Right mvars ->
978 Right mvars ->
979− do logLvl 3 ("Match vars : " ++ show mvars)
979+ do logElab 3 ("Match vars : " ++ show mvars)
980 lhs <- updateLHS n pn wname mvars ns ns' (fullApp tm) w
980 lhs <- updateLHS n pn wname mvars ns ns' (fullApp tm) w
981 return $ PClause fc wname lhs ws rhs wheres
981 return $ PClause fc wname lhs ws rhs wheres
982 mkAux pn wname toplhs ns ns' (PWith fc n tm_in (w:ws) wval pn' withs)
982 mkAux pn wname toplhs ns ns' (PWith fc n tm_in (w:ws) wval pn' withs)
983 = do i <- getIState
983 = do i <- getIState
984 let tm = addImplPat i tm_in
984 let tm = addImplPat i tm_in
985− logLvl 2 ("Matching " ++ showTmImpls tm ++ " against " ++
985+ logElab 2 ("Matching " ++ showTmImpls tm ++ " against " ++
986 showTmImpls toplhs)
986 showTmImpls toplhs)
987 withs' <- mapM (mkAuxC pn wname toplhs ns ns') withs
987 withs' <- mapM (mkAuxC pn wname toplhs ns ns') withs
988 case matchClause i toplhs tm of
988 case matchClause i toplhs tm of
@@ -1001,7 +1001,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
1001 ns' = map (keepMvar (map fst mvars) fc') ns_in' in
1001 ns' = map (keepMvar (map fst mvars) fc') ns_in' in
1002 return $ substMatches mvars $
1002 return $ substMatches mvars $
1003 PApp fc (PRef fc' [] wname)
1003 PApp fc (PRef fc' [] wname)
1004− (map pexp ns ++ pexp w : (map pexp ns') ++
1004+ (map pexp ns ++ pexp w : (map pexp ns') ++
1005 case pn of
1005 case pn of
1006 Nothing -> []
1006 Nothing -> []
1007 Just pnm -> [pexp (PRef fc [] pnm)])
1007 Just pnm -> [pexp (PRef fc [] pnm)])