@@ -35,7 +35,7 @@ import Codec.Compression.Zlib (compress)
3535import Util.Zlib (decompressEither)
3636
3737ibcVersion :: Word8
38−ibcVersion = 94
38+ibcVersion = 95
3939
4040data IBCFile = IBCFile { ver :: Word8,
4141 sourcefile :: FilePath,
@@ -77,7 +77,8 @@ data IBCFile = IBCFile { ver :: Word8,
7777 ibc_metavars :: ![(Name, (Maybe Name, Int, Bool))],
7878 ibc_patdefs :: ![(Name, ([([Name], Term, Term)], [PTerm]))],
7979 ibc_postulates :: ![Name],
80− ibc_parsedSpan :: !(Maybe FC)
80+ ibc_parsedSpan :: !(Maybe FC),
81+ ibc_usage :: ![(Name, Int)]
8182 }
8283 deriving Show
8384{-!
@@ -85,7 +86,7 @@ deriving instance Binary IBCFile
8586!-}
8687
8788initIBC :: IBCFile
88−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing
89+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing []
8990
9091loadIBC :: Bool -- ^ True = reexport, False = make everything private
9192 -> FilePath -> Idris ()
@@ -229,6 +230,7 @@ ibc i (IBCParsedRegion fc) f = return f { ibc_parsedSpan = Just fc }
229230ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
230231 Just v -> return f { ibc_moduledocs = (n,v) : ibc_moduledocs f }
231232 _ -> ifail "IBC write failed"
233+ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
232234
233235process :: Bool -- ^ Reexporting
234236 -> IBCFile -> FilePath -> Idris ()
@@ -285,6 +287,7 @@ process reexp i fn
285287 pMetavars $ force (ibc_metavars i)
286288 pPostulates $ force (ibc_postulates i)
287289 pParsedSpan $ force (ibc_parsedSpan i)
290+ pUsage $ force (ibc_usage i)
288291
289292timestampOlder :: FilePath -> FilePath -> Idris ()
290293timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -302,6 +305,10 @@ pParsedSpan :: Maybe FC -> Idris ()
302305pParsedSpan fc = do ist <- getIState
303306 putIState ist { idris_parsedSpan = fc }
304307
308+pUsage :: [(Name, Int)] -> Idris ()
309+pUsage ns = do ist <- getIState
310+ putIState ist { idris_erasureUsed = ns ++ idris_erasureUsed ist }
311+
305312pImportDirs :: [FilePath] -> Idris ()
306313pImportDirs fs = mapM_ addImportDir fs
307314
@@ -907,7 +914,7 @@ instance Binary MetaInformation where
907914 return (DataMI x1)
908915
909916instance Binary IBCFile where
910− put x@(IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41)
917+ put x@(IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42)
911918 = {-# SCC "putIBCFile" #-}
912919 do put x1
913920 put x2
@@ -950,6 +957,7 @@ instance Binary IBCFile where
950957 put x39
951958 put x40
952959 put x41
960+ put x42
953961
954962 get
955963 = do x1 <- get
@@ -994,7 +1002,8 @@ instance Binary IBCFile where
9941002 x39 <- get
9951003 x40 <- get
9961004 x41 <- get
997− return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41)
1005+ x42 <- get
1006+ return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29 x30 x31 x32 x33 x34 x35 x36 x37 x38 x39 x40 x41 x42)
9981007 else return (initIBC { ver = x1 })
9991008
10001009instance Binary DataOpt where