@@ -38,7 +38,7 @@ mkPatTm t = do i <- getIState
3838 evalStateT (toTT timp) 0
3939 where
4040 toTT (PRef _ n) = do i <- lift getIState
41− case lookupDef Nothing n (tt_ctxt i) of
41+ case lookupDef n (tt_ctxt i) of
4242 [TyDecl nt _] -> return $ P nt n Erased
4343 _ -> return $ P Ref n Erased
4444 toTT (PApp _ t args) = do t' <- toTT t
@@ -107,9 +107,9 @@ expandAlts :: IState -> [CaseAlt] -> SC -> Idris [CaseAlt]
107107expandAlts i all@(ConstCase c _ : alts) def
108108 = return $ all ++ [DefaultCase def]
109109expandAlts i all@(ConCase n _ _ _ : alts) def
110− | (TyDecl c@(DCon _ arity) ty : _) <- lookupDef Nothing n (tt_ctxt i)
110+ | (TyDecl c@(DCon _ arity) ty : _) <- lookupDef n (tt_ctxt i)
111111 = do let tyn = getTy n (tt_ctxt i)
112− case lookupCtxt Nothing tyn (idris_datatypes i) of
112+ case lookupCtxt tyn (idris_datatypes i) of
113113 (TI ns _ _: _) -> do let ps = map mkPat ns
114114 return $ addAlts ps (altsFor all) all
115115 _ -> return all
@@ -127,13 +127,13 @@ expandAlts i all@(ConCase n _ _ _ : alts) def
127127 argList i = take i (map (\x -> (MN x "ign")) [0..])
128128
129129 getTy n ctxt
130− = case lookupTy Nothing n ctxt of
130+ = case lookupTy n ctxt of
131131 (t : _) -> case unApply (getRetTy t) of
132132 (P _ tyn _, _) -> tyn
133133 x -> error $ "Can't happen getTy 1 " ++ show (n, x)
134134 _ -> error "Can't happen getTy 2"
135135
136− mkPat x = case lookupCtxt Nothing x (idris_implicits i) of
136+ mkPat x = case lookupCtxt x (idris_implicits i) of
137137 (pargs : _)
138138 -> (x, length pargs)
139139 _ -> error "Can't happen - genAll"
@@ -160,7 +160,7 @@ genClauses fc n xs given
160160 logLvl 10 $ show argss ++ "\n" ++ show all_args
161161 logLvl 10 $ "Original: \n" ++
162162 showSep "\n" (map (\t -> showImp True (delab' i t True)) xs)
163− let parg = case lookupCtxt Nothing n (idris_implicits i) of
163+ let parg = case lookupCtxt n (idris_implicits i) of
164164 (p : _) -> p
165165 _ -> repeat (pexp Placeholder)
166166 let tryclauses = mkClauses parg all_args
@@ -217,8 +217,8 @@ genAll i args = case filter (/=Placeholder) $ concatMap otherPats (nub args) of
217217 [] -> [Placeholder]
218218 xs -> nub xs
219219 where
220− conForm (PApp _ (PRef fc n) _) = isConName Nothing n (tt_ctxt i)
221− conForm (PRef fc n) = isConName Nothing n (tt_ctxt i)
220+ conForm (PApp _ (PRef fc n) _) = isConName n (tt_ctxt i)
221+ conForm (PRef fc n) = isConName n (tt_ctxt i)
222222 conForm _ = False
223223
224224 otherPats :: PTerm -> [PTerm]
@@ -227,22 +227,22 @@ genAll i args = case filter (/=Placeholder) $ concatMap otherPats (nub args) of
227227 otherPats arg = return Placeholder
228228
229229 ops fc n xs o
230− | (TyDecl c@(DCon _ arity) ty : _) <- lookupDef Nothing n (tt_ctxt i)
230+ | (TyDecl c@(DCon _ arity) ty : _) <- lookupDef n (tt_ctxt i)
231231 = do xs' <- mapM otherPats (map getTm xs)
232232 let p = PApp fc (PRef fc n) (zipWith upd xs' xs)
233233 let tyn = getTy n (tt_ctxt i)
234− case lookupCtxt Nothing tyn (idris_datatypes i) of
234+ case lookupCtxt tyn (idris_datatypes i) of
235235 (TI ns _ _ : _) -> p : map (mkPat fc) (ns \\ [n])
236236 _ -> [p]
237237 ops fc n arg o = return Placeholder
238238
239− getTy n ctxt = case lookupTy Nothing n ctxt of
239+ getTy n ctxt = case lookupTy n ctxt of
240240 (t : _) -> case unApply (getRetTy t) of
241241 (P _ tyn _, _) -> tyn
242242 x -> error $ "Can't happen getTy 1 " ++ show (n, x)
243243 _ -> error "Can't happen getTy 2"
244244
245− mkPat fc x = case lookupCtxt Nothing x (idris_implicits i) of
245+ mkPat fc x = case lookupCtxt x (idris_implicits i) of
246246 (pargs : _)
247247 -> PApp fc (PRef fc x) (map (upd Placeholder) pargs)
248248 _ -> error "Can't happen - genAll"
@@ -306,7 +306,7 @@ calcProd i fc n pats = do patsprod <- mapM prodRec pats
306306
307307 cotype ty
308308 | (P _ t _, _) <- unApply (getRetTy ty)
309− = case lookupCtxt Nothing t (idris_datatypes i) of
309+ = case lookupCtxt t (idris_datatypes i) of
310310 [TI _ True _] -> True
311311 _ -> False
312312 | otherwise = False
@@ -315,7 +315,7 @@ calcTotality :: [Name] -> FC -> Name -> [([Name], Term, Term)]
315315 -> Idris Totality
316316calcTotality path fc n pats
317317 = do i <- getIState
318− let opts = case lookupCtxt Nothing n (idris_flags i) of
318+ let opts = case lookupCtxt n (idris_flags i) of
319319 [fs] -> fs
320320 _ -> []
321321 case mapMaybe (checkLHS i) (map (\ (_, l, r) -> l) pats) of
@@ -339,12 +339,12 @@ checkTotality path fc n
339339 updateContext (simplifyCasedef n)
340340 ctxt <- getContext
341341 i <- getIState
342− let opts = case lookupCtxt Nothing n (idris_flags i) of
342+ let opts = case lookupCtxt n (idris_flags i) of
343343 [fs] -> fs
344344 _ -> []
345345 t' <- case t of
346346 Unchecked ->
347− case lookupDef Nothing n ctxt of
347+ case lookupDef n ctxt of
348348 [CaseOp _ _ _ _ pats _ _ _ _] ->
349349 do t' <- if AssertTotal `elem` opts
350350 then return $ Total []
@@ -378,7 +378,7 @@ checkTotality path fc n
378378
379379 warnPartial n t
380380 = do i <- getIState
381− case lookupDef Nothing n (tt_ctxt i) of
381+ case lookupDef n (tt_ctxt i) of
382382 [x] -> do
383383 iputStrLn $ show fc ++ ":Warning - " ++ show n ++ " is " ++ show t
384384-- ++ "\n" ++ show x
@@ -407,8 +407,8 @@ checkDeclTotality (fc, n)
407407buildSCG :: (FC, Name) -> Idris ()
408408buildSCG (_, n) = do
409409 ist <- getIState
410− case lookupCtxt Nothing n (idris_callgraph ist) of
411− [cg] -> case lookupDef Nothing n (tt_ctxt ist) of
410+ case lookupCtxt n (idris_callgraph ist) of
411+ [cg] -> case lookupDef n (tt_ctxt ist) of
412412 [CaseOp _ _ _ _ _ args sc _ _] ->
413413 do logLvl 3 $ "Building SCG for " ++ show n ++ " from\n"
414414 ++ show sc
@@ -442,7 +442,7 @@ buildSCG' ist sc args = -- trace ("Building SCG for " ++ show sc) $
442442 -- how the arguments relate - either Smaller or Unknown
443443 argRels :: Name -> [(Name, SizeChange)]
444444 argRels n = let ctxt = tt_ctxt ist
445− [ty] = lookupTy Nothing n ctxt -- must exist!
445+ [ty] = lookupTy n ctxt -- must exist!
446446 P _ nty _ = fst (unApply (getRetTy ty))
447447 args = map snd (getArgTys ty) in
448448 map (getRel nty) (map (fst . unApply . getRetTy) args)
@@ -503,7 +503,7 @@ buildSCG' ist sc args = -- trace ("Building SCG for " ++ show sc) $
503503checkSizeChange :: Name -> Idris Totality
504504checkSizeChange n = do
505505 ist <- getIState
506− case lookupCtxt Nothing n (idris_callgraph ist) of
506+ case lookupCtxt n (idris_callgraph ist) of
507507 [cg] -> do let ms = mkMultiPaths ist [] (scg cg)
508508 logLvl 5 ("Multipath for " ++ show n ++ ":\n" ++
509509 "from " ++ show (scg cg) ++ "\n" ++
@@ -530,7 +530,7 @@ mkMultiPaths ist path cg
530530 where extend (nextf, args)
531531 | (nextf, args) `elem` path = [ reverse ((nextf, args) : path) ]
532532 | [Unchecked] <- lookupTotal nextf (tt_ctxt ist)
533− = case lookupCtxt Nothing nextf (idris_callgraph ist) of
533+ = case lookupCtxt nextf (idris_callgraph ist) of
534534 [ncg] -> mkMultiPaths ist ((nextf, args) : path) (scg ncg)
535535 _ -> [ reverse ((nextf, args) : path) ]
536536 | otherwise = [ reverse ((nextf, args) : path) ]
@@ -538,7 +538,7 @@ mkMultiPaths ist path cg
538538-- do (nextf, args) <- cg
539539-- if ((nextf, args) `elem` path)
540540-- then return (reverse ((nextf, args) : path))
541−-- else case lookupCtxt Nothing nextf (idris_callgraph ist) of
541+-- else case lookupCtxt nextf (idris_callgraph ist) of
542542-- [ncg] -> mkMultiPaths ist ((nextf, args) : path) (scg ncg)
543543-- _ -> return (reverse ((nextf, args) : path))
544544
@@ -562,12 +562,12 @@ checkMP ist i mp = if i > 0
562562-- = Partial BelieveMe
563563 -- if we get to a constructor, it's fine as long as it's strictly positive
564564 tryPath desc path ((f, _) :es) arg
565− | [TyDecl (DCon _ _) _] <- lookupDef Nothing f (tt_ctxt ist)
565+ | [TyDecl (DCon _ _) _] <- lookupDef f (tt_ctxt ist)
566566 = case lookupTotal f (tt_ctxt ist) of
567567 [Total _] -> Unchecked -- okay so far
568568 [Partial _] -> Partial (Other [f])
569569 x -> error (show x)
570− | [TyDecl (TCon _ _) _] <- lookupDef Nothing f (tt_ctxt ist)
570+ | [TyDecl (TCon _ _) _] <- lookupDef f (tt_ctxt ist)
571571 = Total []
572572 tryPath desc path (e@(f, args) : es) arg
573573 | e `elem` es && allNothing args = Partial (Mutual [f])