@@ -37,7 +37,7 @@ import Codec.Compression.Zlib (compress)
37import Util.Zlib (decompressEither)
37import Util.Zlib (decompressEither)
39ibcVersion :: Word8
39ibcVersion :: Word8
40−ibcVersion = 98
40+ibcVersion = 99
42data IBCFile = IBCFile { ver :: Word8,
42data IBCFile = IBCFile { ver :: Word8,
43 sourcefile :: FilePath,
43 sourcefile :: FilePath,
@@ -80,7 +80,8 @@ data IBCFile = IBCFile { ver :: Word8,
80 ibc_patdefs :: ![(Name, ([([Name], Term, Term)], [PTerm]))],
80 ibc_patdefs :: ![(Name, ([([Name], Term, Term)], [PTerm]))],
81 ibc_postulates :: ![Name],
81 ibc_postulates :: ![Name],
82 ibc_parsedSpan :: !(Maybe FC),
82 ibc_parsedSpan :: !(Maybe FC),
83− ibc_usage :: ![(Name, Int)]
83+ ibc_usage :: ![(Name, Int)],
84+ ibc_exports :: ![Name]
85 deriving Show
86 deriving Show
@@ -88,7 +89,7 @@ deriving instance Binary IBCFile
90initIBC :: IBCFile
91initIBC :: IBCFile
91−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing []
92+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] []
93loadIBC :: Bool -- ^ True = reexport, False = make everything private
94loadIBC :: Bool -- ^ True = reexport, False = make everything private
94 -> FilePath -> Idris ()
95 -> FilePath -> Idris ()
@@ -233,6 +234,7 @@ ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
233 Just v -> return f { ibc_moduledocs = (n,v) : ibc_moduledocs f }
234 Just v -> return f { ibc_moduledocs = (n,v) : ibc_moduledocs f }
234 _ -> ifail "IBC write failed"
235 _ -> ifail "IBC write failed"
235ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
236ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
237+ibc i (IBCExport n) f = return f { ibc_exports = n : ibc_exports f }
237process :: Bool -- ^ Reexporting
239process :: Bool -- ^ Reexporting
238 -> IBCFile -> FilePath -> Idris ()
240 -> IBCFile -> FilePath -> Idris ()
@@ -290,6 +292,7 @@ process reexp i fn
290 pPostulates $ force (ibc_postulates i)
292 pPostulates $ force (ibc_postulates i)
291 pParsedSpan $ force (ibc_parsedSpan i)
293 pParsedSpan $ force (ibc_parsedSpan i)
292 pUsage $ force (ibc_usage i)
294 pUsage $ force (ibc_usage i)
295+ pExports $ force (ibc_exports i)
294timestampOlder :: FilePath -> FilePath -> Idris ()
297timestampOlder :: FilePath -> FilePath -> Idris ()
295timestampOlder src ibc = do srct <- runIO $ getModificationTime src
298timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -311,6 +314,10 @@ pUsage :: [(Name, Int)] -> Idris ()
311pUsage ns = do ist <- getIState
314pUsage ns = do ist <- getIState
312 putIState ist { idris_erasureUsed = ns ++ idris_erasureUsed ist }
315 putIState ist { idris_erasureUsed = ns ++ idris_erasureUsed ist }
317+pExports :: [Name] -> Idris ()
318+pExports ns = do ist <- getIState
319+ putIState ist { idris_exports = ns ++ idris_exports ist }
314pImportDirs :: [FilePath] -> Idris ()
321pImportDirs :: [FilePath] -> Idris ()
315pImportDirs fs = mapM_ addImportDir fs
322pImportDirs fs = mapM_ addImportDir fs
@@ -927,7 +934,7 @@ instance Binary MetaInformation where
927 _ -> error "Corrupted binary data for MetaInformation"
934 _ -> error "Corrupted binary data for MetaInformation"
929instance Binary IBCFile where
936instance Binary IBCFile where
930− 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)
937+ 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 x43)
931 = {-# SCC "putIBCFile" #-}
938 = {-# SCC "putIBCFile" #-}
932 do put x1
939 do put x1
@@ -971,6 +978,7 @@ instance Binary IBCFile where
976 = do x1 <- get
984 = do x1 <- get
@@ -1016,7 +1024,8 @@ instance Binary IBCFile where
1016 x40 <- get
1024 x40 <- get
1017 x41 <- get
1025 x41 <- get
1018 x42 <- get
1026 x42 <- get
1019− 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)
1028+ 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 x43)
1020 else return (initIBC { ver = x1 })
1029 else return (initIBC { ver = x1 })
1022instance Binary DataOpt where
1031instance Binary DataOpt where