@@ -21,7 +21,7 @@ import System.Directory
2121import Paths_idris
2222
2323ibcVersion :: Word8
24−ibcVersion = 15
24+ibcVersion = 16
2525
2626data IBCFile = IBCFile { ver :: Word8,
2727 sourcefile :: FilePath,
@@ -30,6 +30,7 @@ data IBCFile = IBCFile { ver :: Word8,
3030 ibc_fixes :: [FixDecl],
3131 ibc_statics :: [(Name, [Bool])],
3232 ibc_classes :: [(Name, ClassInfo)],
33+ ibc_instances :: [(Name, Name)],
3334 ibc_dsls :: [(Name, DSL)],
3435 ibc_datatypes :: [(Name, TypeInfo)],
3536 ibc_optimise :: [(Name, OptInfo)],
@@ -48,7 +49,7 @@ deriving instance Binary IBCFile
4849!-}
4950
5051initIBC :: IBCFile
51−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
52+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
5253
5354loadIBC :: FilePath -> Idris ()
5455loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -87,6 +88,8 @@ ibc i (IBCClass n) f
8788 = case lookupCtxt Nothing n (idris_classes i) of
8889 [v] -> return f { ibc_classes = (n,v): ibc_classes f }
8990 _ -> fail "IBC write failed"
91+ibc i (IBCInstance n ins) f
92+ = return f { ibc_instances = (n,ins): ibc_instances f }
9093ibc i (IBCDSL n) f
9194 = case lookupCtxt Nothing n (idris_dsls i) of
9295 [v] -> return f { ibc_dsls = (n,v): ibc_dsls f }
@@ -128,6 +131,7 @@ process i fn
128131 pFixes (ibc_fixes i)
129132 pStatics (ibc_statics i)
130133 pClasses (ibc_classes i)
134+ pInstances (ibc_instances i)
131135 pDSLs (ibc_dsls i)
132136 pDatatypes (ibc_datatypes i)
133137 pOptimise (ibc_optimise i)
@@ -189,6 +193,9 @@ pClasses cs = mapM_ (\ (n, c) ->
189193 = addDef n c (idris_classes i) }))
190194 cs
191195
196+pInstances :: [(Name, Name)] -> Idris ()
197+pInstances cs = mapM_ (\ (n, ins) -> addInstance n ins) cs
198+
192199pDSLs :: [(Name, DSL)] -> Idris ()
193200pDSLs cs = mapM_ (\ (n, c) ->
194201 do i <- getIState
@@ -642,7 +649,7 @@ instance Binary Totality where
642649 _ -> error "Corrupted binary data for Totality"
643650
644651instance Binary IBCFile where
645− put (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20)
652+ put (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21)
646653 = do put x1
647654 put x2
648655 put x3
@@ -663,6 +670,7 @@ instance Binary IBCFile where
663670 put x18
664671 put x19
665672 put x20
673+ put x21
666674 get
667675 = do x1 <- get
668676 if x1 == ibcVersion then
@@ -685,7 +693,8 @@ instance Binary IBCFile where
685693 x18 <- get
686694 x19 <- get
687695 x20 <- get
688− return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20)
696+ x21 <- get
697+ return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21)
689698 else return (initIBC { ver = x1 })
690699
691700instance Binary FnOpt where
@@ -1068,7 +1077,7 @@ instance (Binary t) => Binary (PArg' t) where
10681077
10691078
10701079instance Binary ClassInfo where
1071− put (CI x1 x2 x3 x4)
1080+ put (CI x1 x2 x3 x4 _)
10721081 = do put x1
10731082 put x2
10741083 put x3
@@ -1078,7 +1087,7 @@ instance Binary ClassInfo where
10781087 x2 <- get
10791088 x3 <- get
10801089 x4 <- get
1081− return (CI x1 x2 x3 x4)
1090+ return (CI x1 x2 x3 x4 [])
10821091
10831092instance Binary OptInfo where
10841093 put (Optimise x1 x2 x3)