@@ -30,7 +30,7 @@ import Codec.Compression.Zlib (compress)
3030import Util.Zlib (decompressEither)
3131
3232ibcVersion :: Word8
33−ibcVersion = 69
33+ibcVersion = 70
3434
3535data IBCFile = IBCFile { ver :: Word8,
3636 sourcefile :: FilePath,
@@ -53,6 +53,7 @@ data IBCFile = IBCFile { ver :: Word8,
5353 ibc_hdrs :: [(Codegen, String)],
5454 ibc_access :: [(Name, Accessibility)],
5555 ibc_total :: [(Name, Totality)],
56+ ibc_totcheckfail :: [(FC, String)],
5657 ibc_flags :: [(Name, [FnOpt])],
5758 ibc_cg :: [(Name, CGInfo)],
5859 ibc_defs :: [(Name, Def)],
@@ -75,7 +76,7 @@ deriving instance Binary IBCFile
7576!-}
7677
7778initIBC :: IBCFile
78−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
79+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
7980
8081loadIBC :: FilePath -> Idris ()
8182loadIBC fp = do imps <- getImported
@@ -234,11 +235,12 @@ ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_
234235ibc i (IBCErrorHandler n) f = return f { ibc_errorhandlers = n : ibc_errorhandlers f }
235236ibc i (IBCFunctionErrorHandler fn a n) f =
236237 return f { ibc_function_errorhandlers = (fn, a, n) : ibc_function_errorhandlers f }
237−ibc i (IBCMetavar n) f =
238+ibc i (IBCMetavar n) f =
238239 case lookup n (idris_metavars i) of
239240 Nothing -> return f
240241 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
241242ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
243+ibc i (IBCTotCheckErr fc err) f = return f { ibc_totcheckfail = (fc, err) : ibc_totcheckfail f }
242244
243245process :: IBCFile -> FilePath -> Idris ()
244246process i fn
@@ -246,7 +248,7 @@ process i fn
246248 ifail "Incorrect ibc version --- please rebuild"
247249 | otherwise =
248250 do srcok <- runIO $ doesFileExist (sourcefile i)
249− when srcok $ runIO $ timestampOlder (sourcefile i) fn
251+ when srcok $ timestampOlder (sourcefile i) fn
250252 v <- verbose
251253 quiet <- getQuiet
252254-- when (v && srcok && not quiet) $ iputStrLn $ "Skipping " ++ sourcefile i
@@ -270,6 +272,7 @@ process i fn
270272 pPatdefs (ibc_patdefs i)
271273 pAccess (ibc_access i)
272274 pTotal (ibc_total i)
275+ pTotCheckErr (ibc_totcheckfail i)
273276 pCG (ibc_cg i)
274277 pDocs (ibc_docstrings i)
275278 pCoercions (ibc_coercions i)
@@ -283,11 +286,11 @@ process i fn
283286 pMetavars (ibc_metavars i)
284287 pPostulates (ibc_postulates i)
285288
286−timestampOlder :: FilePath -> FilePath -> IO ()
287−timestampOlder src ibc = do srct <- getModificationTime src
288− ibct <- getModificationTime ibc
289+timestampOlder :: FilePath -> FilePath -> Idris ()
290+timestampOlder src ibc = do srct <- runIO $ getModificationTime src
291+ ibct <- runIO $ getModificationTime ibc
289292 if (srct > ibct)
290− then fail "Needs reloading"
293+ then ifail "Needs reloading"
291294 else return ()
292295
293296pPostulates :: [Name] -> Idris ()
@@ -454,6 +457,10 @@ pTotal ds = mapM_ (\ (n, a) ->
454457 putIState (i { tt_ctxt = setTotal n a (tt_ctxt i) }))
455458 ds
456459
460+pTotCheckErr :: [(FC, String)] -> Idris ()
461+pTotCheckErr es = do ist <- getIState
462+ putIState ist { idris_totcheckfail = idris_totcheckfail ist ++ es }
463+
457464pCG :: [(Name, CGInfo)] -> Idris ()
458465pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
459466
@@ -1161,7 +1168,7 @@ instance Binary MetaInformation where
11611168 return (DataMI x1)
11621169
11631170instance Binary IBCFile where
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)
1171+ 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)
11651172 = {-# SCC "putIBCFile" #-}
11661173 do put x1
11671174 put x2
@@ -1199,6 +1206,7 @@ instance Binary IBCFile where
11991206 put x34
12001207 put x35
12011208 put x36
1209+ put x37
12021210
12031211 get
12041212 = do x1 <- get
@@ -1238,7 +1246,8 @@ instance Binary IBCFile where
12381246 x34 <- get
12391247 x35 <- get
12401248 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)
1249+ x37 <- get
1250+ 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)
12421251 else return (initIBC { ver = x1 })
12431252
12441253instance Binary DataOpt where