@@ -19,6 +19,7 @@ import Data.Vector.Binary
19import Data.List
19import Data.List
20import Data.ByteString.Lazy as B hiding (length, elem, map)
20import Data.ByteString.Lazy as B hiding (length, elem, map)
21import qualified Data.Text as T
21import qualified Data.Text as T
22+import qualified Data.Set as S
23import Control.Monad
24import Control.Monad
24import Control.Monad.State.Strict hiding (get, put)
25import Control.Monad.State.Strict hiding (get, put)
@@ -65,7 +66,8 @@ data IBCFile = IBCFile { ver :: Word8,
65 ibc_errorhandlers :: [Name],
66 ibc_errorhandlers :: [Name],
66 ibc_function_errorhandlers :: [(Name, Name, Name)], -- fn, arg, handler
67 ibc_function_errorhandlers :: [(Name, Name, Name)], -- fn, arg, handler
67 ibc_metavars :: [(Name, (Maybe Name, Int, Bool))],
68 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]
70 deriving Show
72 deriving Show
@@ -73,7 +75,7 @@ deriving instance Binary IBCFile
75initIBC :: IBCFile
77initIBC :: IBCFile
76−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
78+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
78loadIBC :: FilePath -> Idris ()
80loadIBC :: FilePath -> Idris ()
79loadIBC fp = do imps <- getImported
81loadIBC fp = do imps <- getImported
@@ -236,6 +238,7 @@ ibc i (IBCMetavar n) f =
236 case lookup n (idris_metavars i) of
238 case lookup n (idris_metavars i) of
237 Nothing -> return f
239 Nothing -> return f
238 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
240 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 }
240process :: IBCFile -> FilePath -> Idris ()
243process :: IBCFile -> FilePath -> Idris ()
241process i fn
244process i fn
@@ -278,6 +281,7 @@ process i fn
278 pErrorHandlers (ibc_errorhandlers i)
281 pErrorHandlers (ibc_errorhandlers i)
279 pFunctionErrorHandlers (ibc_function_errorhandlers i)
282 pFunctionErrorHandlers (ibc_function_errorhandlers i)
280 pMetavars (ibc_metavars i)
283 pMetavars (ibc_metavars i)
284+ pPostulates (ibc_postulates i)
282timestampOlder :: FilePath -> FilePath -> IO ()
286timestampOlder :: FilePath -> FilePath -> IO ()
283timestampOlder src ibc = do srct <- getModificationTime src
287timestampOlder src ibc = do srct <- getModificationTime src
@@ -286,6 +290,11 @@ timestampOlder src ibc = do srct <- getModificationTime src
286 then fail "Needs reloading"
290 then fail "Needs reloading"
287 else return ()
291 else return ()
293+pPostulates :: [Name] -> Idris ()
296+ putIState i{ idris_postulates = idris_postulates i `S.union` S.fromList ns }
289pImports :: [FilePath] -> Idris ()
298pImports :: [FilePath] -> Idris ()
290pImports fs
299pImports fs
291 = do mapM_ (\f -> do i <- getIState
300 = do mapM_ (\f -> do i <- getIState
@@ -1152,7 +1161,7 @@ instance Binary MetaInformation where
1152 return (DataMI x1)
1161 return (DataMI x1)
1154instance Binary IBCFile where
1163instance 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)
1156 = {-# SCC "putIBCFile" #-}
1165 = {-# SCC "putIBCFile" #-}
1157 do put x1
1166 do put x1
@@ -1189,6 +1198,7 @@ instance Binary IBCFile where
1194 = do x1 <- get
1204 = do x1 <- get
@@ -1227,7 +1237,8 @@ instance Binary IBCFile where
1227 x33 <- get
1237 x33 <- get
1228 x34 <- get
1238 x34 <- get
1229 x35 <- get
1239 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)
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)
1231 else return (initIBC { ver = x1 })
1242 else return (initIBC { ver = x1 })
1233instance Binary DataOpt where
1244instance Binary DataOpt where