@@ -60,7 +60,7 @@ compile codegen f tm
6060 let (residDeps, (reachableNames', minUse)) = minimalUsage depMap
6161 reachableNames = sUN "prim__subBigInt" : sUN "prim__addBigInt" : S.toList reachableNames'
6262 iLOG $ "RESIDUAL DEPS:\n" ++ unlines (map printItem . M.toList $ residDeps)
63− iLOG $ "REACHABLE NAMES: " ++ show reachableNames
63+ iLOG $ "REACHABLE NAMES:\n" ++ unlines (map show reachableNames)
6464
6565 let fmtDepMap = unlines . map (\(n,is) -> show n ++ " -> " ++ show (IS.toList is)) . M.toList
6666 iLOG $ "MINIMAL USAGE:\n" ++ fmtDepMap minUse
@@ -276,16 +276,13 @@ instance ToIR (TT Name) where
276276 Just tm -> return tm
277277 _ -> do
278278 let collapse
279− = case lookupCtxtExact n
280− (idris_optimisation i) of
279+ = case lookupCtxtExact n (idris_optimisation i) of
281280 Just oi -> collapsible oi
282281 _ -> False
283282 let used
284− = case lookupCtxtExact n
285− (idris_callgraph i) of
286− Just (CGInfo _ _ _ _ usedpos) ->
287− usedpos
288− _ -> [] -- TODO: is this correct?
283+ = case lookupCtxtExact n (idris_callgraph i) of
284+ Just (CGInfo _ _ _ _ usedpos) -> Just usedpos
285+ _ -> Nothing
289286 if collapse
290287 then return LNothing
291288 else do
@@ -296,9 +293,10 @@ instance ToIR (TT Name) where
296293 = do f' <- ir' env f
297294 args' <- mapM (ir' env) args
298295 return (LApp False f' args')
299− where mkUsed u i [] = []
300− mkUsed u i (x : xs) | i `elem` u = x : mkUsed u (i + 1) xs
301− | otherwise = LNothing : mkUsed u (i + 1) xs
296+ where mkUsed (Just u) i [] = []
297+ mkUsed (Just u) i (x : xs) | i `elem` u = x : mkUsed (Just u) (i + 1) xs
298+ | otherwise = LNothing : mkUsed (Just u) (i + 1) xs
299+ mkUsed Nothing _ xs = xs
302300-- ir' env (P _ (NS (UN "Z") ["Nat", "Prelude"]) _)
303301-- = return $ LConst (BI 0)
304302 ir' env (P _ n _) = return $ LV (Glob n)