@@ -19,6 +19,7 @@ import Data.Vector.Binary
1919import Data.List
2020import Data.ByteString.Lazy as B hiding (length, elem, map)
2121import qualified Data.Text as T
22+import qualified Data.Set as S
2223
2324import Control.Monad
2425import Control.Monad.State.Strict hiding (get, put)
@@ -65,7 +66,8 @@ data IBCFile = IBCFile { ver :: Word8,
6566 ibc_errorhandlers :: [Name],
6667 ibc_function_errorhandlers :: [(Name, Name, Name)], -- fn, arg, handler
6768 ibc_metavars :: [(Name, (Maybe Name, Int, Bool))],
68− ibc_patdefs :: [(Name, ([([Name], Term, Term)], [PTerm]))]
69+ ibc_patdefs :: [(Name, ([([Name], Term, Term)], [PTerm]))],
70+ ibc_postulates :: [Name]
6971 }
7072 deriving Show
7173{-!
@@ -73,7 +75,7 @@ deriving instance Binary IBCFile
7375!-}
7476
7577initIBC :: IBCFile
76−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
78+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
7779
7880loadIBC :: FilePath -> Idris ()
7981loadIBC fp = do imps <- getImported
@@ -236,6 +238,7 @@ ibc i (IBCMetavar n) f =
236238 case lookup n (idris_metavars i) of
237239 Nothing -> return f
238240 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
241+ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
239242
240243process :: IBCFile -> FilePath -> Idris ()
241244process i fn
@@ -278,6 +281,7 @@ process i fn
278281 pErrorHandlers (ibc_errorhandlers i)
279282 pFunctionErrorHandlers (ibc_function_errorhandlers i)
280283 pMetavars (ibc_metavars i)
284+ pPostulates (ibc_postulates i)
281285
282286timestampOlder :: FilePath -> FilePath -> IO ()
283287timestampOlder src ibc = do srct <- getModificationTime src
@@ -286,6 +290,11 @@ timestampOlder src ibc = do srct <- getModificationTime src
286290 then fail "Needs reloading"
287291 else return ()
288292
293+pPostulates :: [Name] -> Idris ()
294+pPostulates ns = do
295+ i <- getIState
296+ putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
297+
289298pImports :: [FilePath] -> Idris ()
290299pImports fs
291300 = do mapM_ (\f -> do i <- getIState
@@ -1152,7 +1161,7 @@ instance Binary MetaInformation where
11521161 return (DataMI x1)
11531162
11541163instance Binary IBCFile where
1155− 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)
1164+ 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)
11561165 = {-# SCC "putIBCFile" #-}
11571166 do put x1
11581167 put x2
@@ -1189,6 +1198,7 @@ instance Binary IBCFile where
11891198 put x33
11901199 put x34
11911200 put x35
1201+ put x36
11921202
11931203 get
11941204 = do x1 <- get
@@ -1227,7 +1237,8 @@ instance Binary IBCFile where
12271237 x33 <- get
12281238 x34 <- get
12291239 x35 <- get
1230− 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)
1240+ x36 <- get
1241+ 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)
12311242 else return (initIBC { ver = x1 })
12321243
12331244instance Binary DataOpt where