@@ -37,7 +37,7 @@ import Codec.Compression.Zlib (compress)
37import Util.Zlib (decompressEither)
37import Util.Zlib (decompressEither)
39ibcVersion :: Word8
39ibcVersion :: Word8
40−ibcVersion = 101
40+ibcVersion = 102
42data IBCFile = IBCFile { ver :: Word8,
42data IBCFile = IBCFile { ver :: Word8,
43 sourcefile :: FilePath,
43 sourcefile :: FilePath,
@@ -79,6 +79,7 @@ data IBCFile = IBCFile { ver :: Word8,
79 ibc_metavars :: ![(Name, (Maybe Name, Int, Bool))],
79 ibc_metavars :: ![(Name, (Maybe Name, Int, Bool))],
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_externs :: ![(Name, Int)],
82 ibc_parsedSpan :: !(Maybe FC),
83 ibc_parsedSpan :: !(Maybe FC),
83 ibc_usage :: ![(Name, Int)],
84 ibc_usage :: ![(Name, Int)],
84 ibc_exports :: ![Name]
85 ibc_exports :: ![Name]
@@ -89,7 +90,7 @@ deriving instance Binary IBCFile
91initIBC :: IBCFile
92initIBC :: IBCFile
92−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] []
93+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] []
94loadIBC :: Bool -- ^ True = reexport, False = make everything private
95loadIBC :: Bool -- ^ True = reexport, False = make everything private
95 -> FilePath -> Idris ()
96 -> FilePath -> Idris ()
@@ -228,6 +229,7 @@ ibc i (IBCMetavar n) f =
228 Nothing -> return f
229 Nothing -> return f
229 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
230 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
230ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
231ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
232+ibc i (IBCExtern n) f = return f { ibc_externs = n : ibc_externs f }
231ibc i (IBCTotCheckErr fc err) f = return f { ibc_totcheckfail = (fc, err) : ibc_totcheckfail f }
233ibc i (IBCTotCheckErr fc err) f = return f { ibc_totcheckfail = (fc, err) : ibc_totcheckfail f }
232ibc i (IBCParsedRegion fc) f = return f { ibc_parsedSpan = Just fc }
234ibc i (IBCParsedRegion fc) f = return f { ibc_parsedSpan = Just fc }
233ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
235ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
@@ -290,6 +292,7 @@ process reexp i fn
290 pFunctionErrorHandlers $ force (ibc_function_errorhandlers i)
292 pFunctionErrorHandlers $ force (ibc_function_errorhandlers i)
291 pMetavars $ force (ibc_metavars i)
293 pMetavars $ force (ibc_metavars i)
292 pPostulates $ force (ibc_postulates i)
294 pPostulates $ force (ibc_postulates i)
295+ pExterns $ force (ibc_externs i)
293 pParsedSpan $ force (ibc_parsedSpan i)
296 pParsedSpan $ force (ibc_parsedSpan i)
294 pUsage $ force (ibc_usage i)
297 pUsage $ force (ibc_usage i)
295 pExports $ force (ibc_exports i)
298 pExports $ force (ibc_exports i)
@@ -306,6 +309,11 @@ pPostulates ns = do
306 i <- getIState
309 i <- getIState
307 putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
310 putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
312+pExterns :: [(Name, Int)] -> Idris ()
315+ putIState i{ idris_externs = idris_externs i `S.union` S.fromList ns }
309pParsedSpan :: Maybe FC -> Idris ()
317pParsedSpan :: Maybe FC -> Idris ()
310pParsedSpan fc = do ist <- getIState
318pParsedSpan fc = do ist <- getIState
311 putIState ist { idris_parsedSpan = fc }
319 putIState ist { idris_parsedSpan = fc }
@@ -934,7 +942,7 @@ instance Binary MetaInformation where
934 _ -> error "Corrupted binary data for MetaInformation"
942 _ -> error "Corrupted binary data for MetaInformation"
936instance Binary IBCFile where
944instance Binary IBCFile where
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)
945+ 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 x44)
938 = {-# SCC "putIBCFile" #-}
946 = {-# SCC "putIBCFile" #-}
939 do put x1
947 do put x1
@@ -979,6 +987,7 @@ instance Binary IBCFile where
984 = do x1 <- get
993 = do x1 <- get
@@ -1025,7 +1034,8 @@ instance Binary IBCFile where
1025 x41 <- get
1034 x41 <- get
1026 x42 <- get
1035 x42 <- get
1027 x43 <- get
1036 x43 <- get
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)
1038+ 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 x44)
1029 else return (initIBC { ver = x1 })
1039 else return (initIBC { ver = x1 })
1031instance Binary DataOpt where
1041instance Binary DataOpt where
@@ -1271,7 +1281,7 @@ instance (Binary t) => Binary (PDecl' t) where
1271 PMutual x1 x2 -> do putWord8 11
1281 PMutual x1 x2 -> do putWord8 11
1274− PPostulate x1 x2 x3 x4 x5 x6
1284+ PPostulate x1 x2 x3 x4 x5 x6 x7
1275 -> do putWord8 12
1285 -> do putWord8 12
@@ -1279,6 +1289,7 @@ instance (Binary t) => Binary (PDecl' t) where
1282 PSyntax x1 x2 -> do putWord8 13
1293 PSyntax x1 x2 -> do putWord8 13
@@ -1376,7 +1387,8 @@ instance (Binary t) => Binary (PDecl' t) where
1376 x4 <- get
1387 x4 <- get
1377 x5 <- get
1388 x5 <- get
1378 x6 <- get
1389 x6 <- get
1379− return (PPostulate x1 x2 x3 x4 x5 x6)
1391+ return (PPostulate x1 x2 x3 x4 x5 x6 x7)
1380 13 -> do x1 <- get
1392 13 -> do x1 <- get
1381 x2 <- get
1393 x2 <- get
1382 return (PSyntax x1 x2)
1394 return (PSyntax x1 x2)