@@ -30,7 +30,7 @@ import Codec.Compression.Zlib (compress)
30import Util.Zlib (decompressEither)
30import Util.Zlib (decompressEither)
32ibcVersion :: Word8
32ibcVersion :: Word8
33−ibcVersion = 69
33+ibcVersion = 70
35data IBCFile = IBCFile { ver :: Word8,
35data IBCFile = IBCFile { ver :: Word8,
36 sourcefile :: FilePath,
36 sourcefile :: FilePath,
@@ -53,6 +53,7 @@ data IBCFile = IBCFile { ver :: Word8,
53 ibc_hdrs :: [(Codegen, String)],
53 ibc_hdrs :: [(Codegen, String)],
54 ibc_access :: [(Name, Accessibility)],
54 ibc_access :: [(Name, Accessibility)],
55 ibc_total :: [(Name, Totality)],
55 ibc_total :: [(Name, Totality)],
56+ ibc_totcheckfail :: [(FC, String)],
56 ibc_flags :: [(Name, [FnOpt])],
57 ibc_flags :: [(Name, [FnOpt])],
57 ibc_cg :: [(Name, CGInfo)],
58 ibc_cg :: [(Name, CGInfo)],
58 ibc_defs :: [(Name, Def)],
59 ibc_defs :: [(Name, Def)],
@@ -75,7 +76,7 @@ deriving instance Binary IBCFile
77initIBC :: IBCFile
78initIBC :: IBCFile
78−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
79+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
80loadIBC :: FilePath -> Idris ()
81loadIBC :: FilePath -> Idris ()
81loadIBC fp = do imps <- getImported
82loadIBC fp = do imps <- getImported
@@ -234,11 +235,12 @@ ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_
234ibc i (IBCErrorHandler n) f = return f { ibc_errorhandlers = n : ibc_errorhandlers f }
235ibc i (IBCErrorHandler n) f = return f { ibc_errorhandlers = n : ibc_errorhandlers f }
235ibc i (IBCFunctionErrorHandler fn a n) f =
236ibc i (IBCFunctionErrorHandler fn a n) f =
236 return f { ibc_function_errorhandlers = (fn, a, n) : ibc_function_errorhandlers f }
237 return f { ibc_function_errorhandlers = (fn, a, n) : ibc_function_errorhandlers f }
237−ibc i (IBCMetavar n) f =
238+ibc i (IBCMetavar n) f =
238 case lookup n (idris_metavars i) of
239 case lookup n (idris_metavars i) of
239 Nothing -> return f
240 Nothing -> return f
240 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
241 Just t -> return f { ibc_metavars = (n, t) : ibc_metavars f }
241ibc i (IBCPostulate n) f = return f { ibc_postulates = n : ibc_postulates f }
242ibc 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 }
243process :: IBCFile -> FilePath -> Idris ()
245process :: IBCFile -> FilePath -> Idris ()
244process i fn
246process i fn
@@ -246,7 +248,7 @@ process i fn
246 ifail "Incorrect ibc version --- please rebuild"
248 ifail "Incorrect ibc version --- please rebuild"
247 | otherwise =
249 | otherwise =
248 do srcok <- runIO $ doesFileExist (sourcefile i)
250 do srcok <- runIO $ doesFileExist (sourcefile i)
249− when srcok $ runIO $ timestampOlder (sourcefile i) fn
251+ when srcok $ timestampOlder (sourcefile i) fn
250 v <- verbose
252 v <- verbose
251 quiet <- getQuiet
253 quiet <- getQuiet
252-- when (v && srcok && not quiet) $ iputStrLn $ "Skipping " ++ sourcefile i
254-- when (v && srcok && not quiet) $ iputStrLn $ "Skipping " ++ sourcefile i
@@ -270,6 +272,7 @@ process i fn
270 pPatdefs (ibc_patdefs i)
272 pPatdefs (ibc_patdefs i)
271 pAccess (ibc_access i)
273 pAccess (ibc_access i)
272 pTotal (ibc_total i)
274 pTotal (ibc_total i)
275+ pTotCheckErr (ibc_totcheckfail i)
273 pCG (ibc_cg i)
276 pCG (ibc_cg i)
274 pDocs (ibc_docstrings i)
277 pDocs (ibc_docstrings i)
275 pCoercions (ibc_coercions i)
278 pCoercions (ibc_coercions i)
@@ -283,11 +286,11 @@ process i fn
283 pMetavars (ibc_metavars i)
286 pMetavars (ibc_metavars i)
284 pPostulates (ibc_postulates i)
287 pPostulates (ibc_postulates i)
286−timestampOlder :: FilePath -> FilePath -> IO ()
289+timestampOlder :: FilePath -> FilePath -> Idris ()
287−timestampOlder src ibc = do srct <- getModificationTime src
290+timestampOlder src ibc = do srct <- runIO $ getModificationTime src
288− ibct <- getModificationTime ibc
291+ ibct <- runIO $ getModificationTime ibc
289 if (srct > ibct)
292 if (srct > ibct)
290− then fail "Needs reloading"
293+ then ifail "Needs reloading"
291 else return ()
294 else return ()
293pPostulates :: [Name] -> Idris ()
296pPostulates :: [Name] -> Idris ()
@@ -454,6 +457,10 @@ pTotal ds = mapM_ (\ (n, a) ->
454 putIState (i { tt_ctxt = setTotal n a (tt_ctxt i) }))
457 putIState (i { tt_ctxt = setTotal n a (tt_ctxt i) }))
460+pTotCheckErr :: [(FC, String)] -> Idris ()
461+pTotCheckErr es = do ist <- getIState
462+ putIState ist { idris_totcheckfail = idris_totcheckfail ist ++ es }
457pCG :: [(Name, CGInfo)] -> Idris ()
464pCG :: [(Name, CGInfo)] -> Idris ()
458pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
465pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
@@ -1161,7 +1168,7 @@ instance Binary MetaInformation where
1161 return (DataMI x1)
1168 return (DataMI x1)
1163instance Binary IBCFile where
1170instance 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)
1165 = {-# SCC "putIBCFile" #-}
1172 = {-# SCC "putIBCFile" #-}
1166 do put x1
1173 do put x1
@@ -1199,6 +1206,7 @@ instance Binary IBCFile where
1204 = do x1 <- get
1212 = do x1 <- get
@@ -1238,7 +1246,8 @@ instance Binary IBCFile where
1238 x34 <- get
1246 x34 <- get
1239 x35 <- get
1247 x35 <- get
1240 x36 <- get
1248 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)
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)
1242 else return (initIBC { ver = x1 })
1251 else return (initIBC { ver = x1 })
1244instance Binary DataOpt where
1253instance Binary DataOpt where