@@ -21,7 +21,7 @@ import System.Directory
21import Paths_idris
21import Paths_idris
23ibcVersion :: Word8
23ibcVersion :: Word8
24−ibcVersion = 26
24+ibcVersion = 27
26data IBCFile = IBCFile { ver :: Word8,
26data IBCFile = IBCFile { ver :: Word8,
27 sourcefile :: FilePath,
27 sourcefile :: FilePath,
@@ -44,14 +44,15 @@ data IBCFile = IBCFile { ver :: Word8,
44 ibc_flags :: [(Name, [FnOpt])],
44 ibc_flags :: [(Name, [FnOpt])],
45 ibc_cg :: [(Name, CGInfo)],
45 ibc_cg :: [(Name, CGInfo)],
46 ibc_defs :: [(Name, Def)],
46 ibc_defs :: [(Name, Def)],
47− ibc_docstrings :: [(Name, String)]
47+ ibc_docstrings :: [(Name, String)],
48+ ibc_coercions :: [Name]
50deriving instance Binary IBCFile
51deriving instance Binary IBCFile
53initIBC :: IBCFile
54initIBC :: IBCFile
54−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
55+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
56loadIBC :: FilePath -> Idris ()
57loadIBC :: FilePath -> Idris ()
57loadIBC fp = do iLOG $ "Loading ibc " ++ fp
58loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -119,6 +120,7 @@ ibc i (IBCDoc n) f = case lookupCtxt Nothing n (idris_docstrings i) of
119ibc i (IBCCG n) f = case lookupCtxt Nothing n (idris_callgraph i) of
120ibc i (IBCCG n) f = case lookupCtxt Nothing n (idris_callgraph i) of
120 [v] -> return f { ibc_cg = (n,v) : ibc_cg f }
121 [v] -> return f { ibc_cg = (n,v) : ibc_cg f }
121 _ -> fail "IBC write failed"
122 _ -> fail "IBC write failed"
123+ibc i (IBCCoercion n) f = return f { ibc_coercions = n : ibc_coercions f }
122ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
124ibc i (IBCAccess n a) f = return f { ibc_access = (n,a) : ibc_access f }
123ibc i (IBCFlags n a) f = return f { ibc_flags = (n,a) : ibc_flags f }
125ibc i (IBCFlags n a) f = return f { ibc_flags = (n,a) : ibc_flags f }
124ibc i (IBCTotal n a) f = return f { ibc_total = (n,a) : ibc_total f }
126ibc i (IBCTotal n a) f = return f { ibc_total = (n,a) : ibc_total f }
@@ -151,6 +153,7 @@ process i fn
151 pTotal (ibc_total i)
153 pTotal (ibc_total i)
152 pCG (ibc_cg i)
154 pCG (ibc_cg i)
153 pDocs (ibc_docstrings i)
155 pDocs (ibc_docstrings i)
156+ pCoercions (ibc_coercions i)
155timestampOlder :: FilePath -> FilePath -> IO ()
158timestampOlder :: FilePath -> FilePath -> IO ()
156timestampOlder src ibc = do srct <- getModificationTime src
159timestampOlder src ibc = do srct <- getModificationTime src
@@ -270,6 +273,9 @@ pTotal ds = mapM_ (\ (n, a) ->
270pCG :: [(Name, CGInfo)] -> Idris ()
273pCG :: [(Name, CGInfo)] -> Idris ()
271pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
274pCG ds = mapM_ (\ (n, a) -> addToCG n a) ds
276+pCoercions :: [Name] -> Idris ()
277+pCoercions ns = mapM_ (\ n -> addCoercion n) ns
273----- Generated by 'derive'
279----- Generated by 'derive'
275instance Binary SizeChange where
281instance Binary SizeChange where
@@ -738,7 +744,7 @@ instance Binary Totality where
738 _ -> error "Corrupted binary data for Totality"
744 _ -> error "Corrupted binary data for Totality"
740instance Binary IBCFile where
746instance Binary IBCFile where
741− put (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22)
747+ put (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23)
742 = do put x1
748 = do put x1
@@ -761,6 +767,7 @@ instance Binary IBCFile where
765 = do x1 <- get
772 = do x1 <- get
766 if x1 == ibcVersion then
773 if x1 == ibcVersion then
@@ -785,7 +792,8 @@ instance Binary IBCFile where
785 x20 <- get
792 x20 <- get
786 x21 <- get
793 x21 <- get
787 x22 <- get
794 x22 <- get
788− return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22)
796+ 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)
789 else return (initIBC { ver = x1 })
797 else return (initIBC { ver = x1 })
791instance Binary FnOpt where
799instance Binary FnOpt where
@@ -799,6 +807,7 @@ instance Binary FnOpt where
800 Coinductive -> putWord8 5
808 Coinductive -> putWord8 5
801 PartialFn -> putWord8 6
809 PartialFn -> putWord8 6
810+ Implicit -> putWord8 7
803 = do i <- getWord8
812 = do i <- getWord8
804 case i of
813 case i of
@@ -810,6 +819,7 @@ instance Binary FnOpt where
810 return (Specialise x)
819 return (Specialise x)
811 5 -> return Coinductive
820 5 -> return Coinductive
812 6 -> return PartialFn
821 6 -> return PartialFn
822+ 7 -> return Implicit
813 _ -> error "Corrupted binary data for FnOpt"
823 _ -> error "Corrupted binary data for FnOpt"
815instance Binary Fixity where
825instance Binary Fixity where