@@ -24,9 +24,8 @@ import System.Directory
2424import Codec.Compression.Zlib (compress)
2525import Util.Zlib (decompressEither)
2626
27−
2827ibcVersion :: Word8
29−ibcVersion = 60
28+ibcVersion = 61
3029
3130
3231data IBCFile = IBCFile { ver :: Word8,
@@ -61,7 +60,8 @@ data IBCFile = IBCFile { ver :: Word8,
6160 ibc_namehints :: [(Name, Name)],
6261 ibc_metainformation :: [(Name, MetaInformation)],
6362 ibc_errorhandlers :: [Name],
64− ibc_function_errorhandlers :: [(Name, Name, Name)] -- fn, arg, handler
63+ ibc_function_errorhandlers :: [(Name, Name, Name)], -- fn, arg, handler
64+ ibc_metavars :: [(Name, (Maybe Name, Int, Bool))]
6565 }
6666 deriving Show
6767{-!
@@ -69,8 +69,7 @@ deriving instance Binary IBCFile
6969!-}
7070
7171initIBC :: IBCFile
72−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
73−
72+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
7473
7574loadIBC :: FilePath -> Idris ()
7675loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -91,9 +90,9 @@ writeIBC :: FilePath -> FilePath -> Idris ()
9190writeIBC src f
9291 = do iLOG $ "Writing ibc " ++ show f
9392 i <- getIState
94− case (Data.List.map fst (idris_metavars i)) \\ primDefs of
95− (_:_) -> ifail "Can't write ibc when there are unsolved metavariables"
96− [] -> return ()
93+-- case (Data.List.map fst (idris_metavars i)) \\ primDefs of
94+-- (_:_) -> ifail "Can't write ibc when there are unsolved metavariables"
95+-- [] -> return ()
9796 resetNameIdx
9897 ibcf <- mkIBC (ibc_write i) (initIBC { sourcefile = src })
9998 idrisCatch (do runIO $ createDirectoryIfMissing True (dropFileName f)
@@ -222,6 +221,10 @@ ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_
222221ibc i (IBCErrorHandler n) f = return f { ibc_errorhandlers = n : ibc_errorhandlers f }
223222ibc i (IBCFunctionErrorHandler fn a n) f =
224223 return f { ibc_function_errorhandlers = (fn, a, n) : ibc_function_errorhandlers f }
224+ibc i (IBCMetavar n) f =
225+ case lookup n (idris_metavars i) of
226+ Nothing -> return f
227+ Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
225228
226229process :: IBCFile -> FilePath -> Idris ()
227230process i fn
@@ -262,6 +265,7 @@ process i fn
262265 pMetaInformation (ibc_metainformation i)
263266 pErrorHandlers (ibc_errorhandlers i)
264267 pFunctionErrorHandlers (ibc_function_errorhandlers i)
268+ pMetavars (ibc_metavars i)
265269
266270timestampOlder :: FilePath -> FilePath -> IO ()
267271timestampOlder src ibc = do srct <- getModificationTime src
@@ -451,6 +455,12 @@ pFunctionErrorHandlers :: [(Name, Name, Name)] -> Idris ()
451455pFunctionErrorHandlers [] = return ()
452456pFunctionErrorHandlers ((fn, arg, handler):ns) = do addFunctionErrorHandlers fn arg [handler]
453457 pFunctionErrorHandlers ns
458+
459+pMetavars :: [(Name, (Maybe Name, Int, Bool))] -> Idris ()
460+pMetavars ns = do i <- getIState
461+ putIState $ i { idris_metavars = Data.List.reverse ns
462+ ++ idris_metavars i }
463+
454464----- Generated by 'derive'
455465
456466instance Binary SizeChange where
@@ -1037,7 +1047,7 @@ instance Binary MetaInformation where
10371047 return (DataMI x1)
10381048
10391049instance Binary IBCFile where
1040− 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)
1050+ 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)
10411051 = {-# SCC "putIBCFile" #-}
10421052 do put x1
10431053 put x2
@@ -1072,6 +1082,7 @@ instance Binary IBCFile where
10721082 put x31
10731083 put x32
10741084 put x33
1085+ put x34
10751086
10761087 get
10771088 = do x1 <- get
@@ -1108,7 +1119,8 @@ instance Binary IBCFile where
11081119 x31 <- get
11091120 x32 <- get
11101121 x33 <- get
1111− 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)
1122+ x34 <- get
1123+ 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)
11121124 else return (initIBC { ver = x1 })
11131125
11141126instance Binary DataOpt where