@@ -35,7 +35,7 @@ import Codec.Compression.Zlib (compress)
35import Util.Zlib (decompressEither)
35import Util.Zlib (decompressEither)
37ibcVersion :: Word8
37ibcVersion :: Word8
38−ibcVersion = 94
38+ibcVersion = 95
40data IBCFile = IBCFile { ver :: Word8,
40data IBCFile = IBCFile { ver :: Word8,
41 sourcefile :: FilePath,
41 sourcefile :: FilePath,
@@ -77,7 +77,8 @@ data IBCFile = IBCFile { ver :: Word8,
77 ibc_metavars :: ![(Name, (Maybe Name, Int, Bool))],
77 ibc_metavars :: ![(Name, (Maybe Name, Int, Bool))],
78 ibc_patdefs :: ![(Name, ([([Name], Term, Term)], [PTerm]))],
78 ibc_patdefs :: ![(Name, ([([Name], Term, Term)], [PTerm]))],
79 ibc_postulates :: ![Name],
79 ibc_postulates :: ![Name],
80− ibc_parsedSpan :: !(Maybe FC)
80+ ibc_parsedSpan :: !(Maybe FC),
81+ ibc_usage :: ![(Name, Int)]
82 deriving Show
83 deriving Show
@@ -85,7 +86,7 @@ deriving instance Binary IBCFile
87initIBC :: IBCFile
88initIBC :: IBCFile
88−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing
89+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing []
90loadIBC :: Bool -- ^ True = reexport, False = make everything private
91loadIBC :: Bool -- ^ True = reexport, False = make everything private
91 -> FilePath -> Idris ()
92 -> FilePath -> Idris ()
@@ -229,6 +230,7 @@ ibc i (IBCParsedRegion fc) f = return f { ibc_parsedSpan = Just fc }
229ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
230ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
230 Just v -> return f { ibc_moduledocs = (n,v) : ibc_moduledocs f }
231 Just v -> return f { ibc_moduledocs = (n,v) : ibc_moduledocs f }
231 _ -> ifail "IBC write failed"
232 _ -> ifail "IBC write failed"
233+ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
233process :: Bool -- ^ Reexporting
235process :: Bool -- ^ Reexporting
234 -> IBCFile -> FilePath -> Idris ()
236 -> IBCFile -> FilePath -> Idris ()
@@ -285,6 +287,7 @@ process reexp i fn
285 pMetavars $ force (ibc_metavars i)
287 pMetavars $ force (ibc_metavars i)
286 pPostulates $ force (ibc_postulates i)
288 pPostulates $ force (ibc_postulates i)
287 pParsedSpan $ force (ibc_parsedSpan i)
289 pParsedSpan $ force (ibc_parsedSpan i)
290+ pUsage $ force (ibc_usage i)
289timestampOlder :: FilePath -> FilePath -> Idris ()
292timestampOlder :: FilePath -> FilePath -> Idris ()
290timestampOlder src ibc = do srct <- runIO $ getModificationTime src
293timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -302,6 +305,10 @@ pParsedSpan :: Maybe FC -> Idris ()
302pParsedSpan fc = do ist <- getIState
305pParsedSpan fc = do ist <- getIState
303 putIState ist { idris_parsedSpan = fc }
306 putIState ist { idris_parsedSpan = fc }
308+pUsage :: [(Name, Int)] -> Idris ()
309+pUsage ns = do ist <- getIState
310+ putIState ist { idris_erasureUsed = ns ++ idris_erasureUsed ist }
305pImportDirs :: [FilePath] -> Idris ()
312pImportDirs :: [FilePath] -> Idris ()
306pImportDirs fs = mapM_ addImportDir fs
313pImportDirs fs = mapM_ addImportDir fs
@@ -907,7 +914,7 @@ instance Binary MetaInformation where
907 return (DataMI x1)
914 return (DataMI x1)
909instance Binary IBCFile where
916instance 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)
911 = {-# SCC "putIBCFile" #-}
918 = {-# SCC "putIBCFile" #-}
912 do put x1
919 do put x1
@@ -950,6 +957,7 @@ instance Binary IBCFile where
955 = do x1 <- get
963 = do x1 <- get
@@ -994,7 +1002,8 @@ instance Binary IBCFile where
994 x39 <- get
1002 x39 <- get
995 x40 <- get
1003 x40 <- get
996 x41 <- get
1004 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)
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)
998 else return (initIBC { ver = x1 })
1007 else return (initIBC { ver = x1 })
1000instance Binary DataOpt where
1009instance Binary DataOpt where