on master help sign in
Improve printing of UseMaps.
bb02275Matus Tejiscak
src/Idris/Erasure.hs+8−1
@@ -93,7 +93,14 @@ performUsageAnalysis = do
93 fmtItem (cond, deps) = indent $ show (S.toList cond) ++ " -> " ++ show (M.toList deps)
93 fmtItem (cond, deps) = indent $ show (S.toList cond) ++ " -> " ++ show (M.toList deps)
94
94
95 fmtUseMap :: [(Name, IntMap (Set Reason))] -> String
95 fmtUseMap :: [(Name, IntMap (Set Reason))] -> String
96− fmtUseMap = unlines . map (\(n,is) -> indent $ show n ++ " -> " ++ show (IM.toList is))
96+ fmtUseMap = unlines . map (\(n,is) -> indent $ show n ++ " -> " ++ fmtIxs is)
97+
98+ fmtIxs :: IntMap (Set Reason) -> String
99+ fmtIxs = intercalate ", " . map fmtArg . IM.toList
100+ where
101+ fmtArg (i, rs)
102+ | S.null rs = show i
103+ | otherwise = show i ++ " from " ++ intercalate ", " (map show $ S.toList rs)
97
104
98 storeUsage :: Ctxt CGInfo -> (Name, IntMap (Set Reason)) -> Idris ()
105 storeUsage :: Ctxt CGInfo -> (Name, IntMap (Set Reason)) -> Idris ()
99 storeUsage cg (n, args)
106 storeUsage cg (n, args)