@@ -26,7 +26,7 @@ import Util.Zlib (decompressEither)
28ibcVersion :: Word8
28ibcVersion :: Word8
29−ibcVersion = 54
29+ibcVersion = 55
31data IBCFile = IBCFile { ver :: Word8,
31data IBCFile = IBCFile { ver :: Word8,
32 sourcefile :: FilePath,
32 sourcefile :: FilePath,
@@ -57,7 +57,9 @@ data IBCFile = IBCFile { ver :: Word8,
57 ibc_coercions :: [Name],
57 ibc_coercions :: [Name],
58 ibc_lineapps :: [(FilePath, Int, PTerm)],
58 ibc_lineapps :: [(FilePath, Int, PTerm)],
59 ibc_namehints :: [(Name, Name)],
59 ibc_namehints :: [(Name, Name)],
60− ibc_metainformation :: [(Name, MetaInformation)]
60+ ibc_metainformation :: [(Name, MetaInformation)],
61+ ibc_errorhandlers :: [Name],
62+ ibc_function_errorhandlers :: [(Name, Name, Name)] -- fn, arg, handler
62 deriving Show
64 deriving Show
@@ -65,7 +67,7 @@ deriving instance Binary IBCFile
67initIBC :: IBCFile
69initIBC :: IBCFile
68−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
70+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
70loadIBC :: FilePath -> Idris ()
72loadIBC :: FilePath -> Idris ()
71loadIBC fp = do iLOG $ "Loading ibc " ++ fp
73loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -213,6 +215,9 @@ ibc i (IBCLineApp fp l t) f
213ibc i (IBCNameHint (n, ty)) f
215ibc i (IBCNameHint (n, ty)) f
214 = return f { ibc_namehints = (n, ty) : ibc_namehints f }
216 = return f { ibc_namehints = (n, ty) : ibc_namehints f }
215ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_metainformation f }
217ibc i (IBCMetaInformation n m) f = return f { ibc_metainformation = (n,m) : ibc_metainformation f }
218+ibc i (IBCErrorHandler n) f = return f { ibc_errorhandlers = n : ibc_errorhandlers f }
219+ibc i (IBCFunctionErrorHandler fn a n) f =
220+ return f { ibc_function_errorhandlers = (fn, a, n) : ibc_function_errorhandlers f }
217process :: IBCFile -> FilePath -> Idris ()
222process :: IBCFile -> FilePath -> Idris ()
218process i fn
223process i fn
@@ -250,6 +255,8 @@ process i fn
250 pLineApps (ibc_lineapps i)
255 pLineApps (ibc_lineapps i)
251 pNameHints (ibc_namehints i)
256 pNameHints (ibc_namehints i)
252 pMetaInformation (ibc_metainformation i)
257 pMetaInformation (ibc_metainformation i)
258+ pErrorHandlers (ibc_errorhandlers i)
259+ pFunctionErrorHandlers (ibc_function_errorhandlers i)
254timestampOlder :: FilePath -> FilePath -> IO ()
261timestampOlder :: FilePath -> FilePath -> IO ()
255timestampOlder src ibc = do srct <- getModificationTime src
262timestampOlder src ibc = do srct <- getModificationTime src
@@ -428,6 +435,14 @@ pMetaInformation ds = mapM_ (\ (n, m) ->
428 putIState (i { tt_ctxt = setMetaInformation n m (tt_ctxt i) }))
435 putIState (i { tt_ctxt = setMetaInformation n m (tt_ctxt i) }))
438+pErrorHandlers :: [Name] -> Idris ()
439+pErrorHandlers ns = do i <- getIState
440+ putIState $ i { idris_errorhandlers = idris_errorhandlers i ++ ns }
442+pFunctionErrorHandlers :: [(Name, Name, Name)] -> Idris ()
443+pFunctionErrorHandlers [] = return ()
444+pFunctionErrorHandlers ((fn, arg, handler):ns) = do addFunctionErrorHandlers fn arg [handler]
445+ pFunctionErrorHandlers ns
431----- Generated by 'derive'
446----- Generated by 'derive'
433instance Binary SizeChange where
448instance Binary SizeChange where
@@ -1012,7 +1027,7 @@ instance Binary MetaInformation where
1012 return (DataMI x1)
1027 return (DataMI x1)
1014instance Binary IBCFile where
1029instance Binary IBCFile where
1015− 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)
1030+ 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)
1016 = {-# SCC "putIBCFile" #-}
1031 = {-# SCC "putIBCFile" #-}
1017 do put x1
1032 do put x1
@@ -1044,6 +1059,8 @@ instance Binary IBCFile where
1048 = do x1 <- get
1065 = do x1 <- get
1049 if x1 == ibcVersion then
1066 if x1 == ibcVersion then
@@ -1076,7 +1093,9 @@ instance Binary IBCFile where
1076 x28 <- get
1093 x28 <- get
1077 x29 <- get
1094 x29 <- get
1078 x30 <- get
1095 x30 <- get
1079− 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)
1098+ 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)
1080 else return (initIBC { ver = x1 })
1099 else return (initIBC { ver = x1 })
1082instance Binary DataOpt where
1101instance Binary DataOpt where