@@ -37,7 +37,7 @@ import Codec.Compression.Zlib (compress)
37import Util.Zlib (decompressEither)
37import Util.Zlib (decompressEither)
39ibcVersion :: Word8
39ibcVersion :: Word8
40−ibcVersion = 103
40+ibcVersion = 104
42data IBCFile = IBCFile { ver :: Word8,
42data IBCFile = IBCFile { ver :: Word8,
43 sourcefile :: FilePath,
43 sourcefile :: FilePath,
@@ -82,7 +82,8 @@ data IBCFile = IBCFile { ver :: Word8,
82 ibc_externs :: ![(Name, Int)],
82 ibc_externs :: ![(Name, Int)],
83 ibc_parsedSpan :: !(Maybe FC),
83 ibc_parsedSpan :: !(Maybe FC),
84 ibc_usage :: ![(Name, Int)],
84 ibc_usage :: ![(Name, Int)],
85− ibc_exports :: ![Name]
85+ ibc_exports :: ![Name],
86+ ibc_autohints :: ![(Name, Name)]
87 deriving Show
88 deriving Show
@@ -90,7 +91,7 @@ deriving instance Binary IBCFile
92initIBC :: IBCFile
93initIBC :: IBCFile
93−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] []
94+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] [] []
95loadIBC :: Bool -- ^ True = reexport, False = make everything private
96loadIBC :: Bool -- ^ True = reexport, False = make everything private
96 -> FilePath -> Idris ()
97 -> FilePath -> Idris ()
@@ -237,6 +238,7 @@ ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
237 _ -> ifail "IBC write failed"
238 _ -> ifail "IBC write failed"
238ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
239ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
239ibc i (IBCExport n) f = return f { ibc_exports = n : ibc_exports f }
240ibc i (IBCExport n) f = return f { ibc_exports = n : ibc_exports f }
241+ibc i (IBCAutoHint n h) f = return f { ibc_autohints = (n, h) : ibc_autohints f }
241process :: Bool -- ^ Reexporting
243process :: Bool -- ^ Reexporting
242 -> IBCFile -> FilePath -> Idris ()
244 -> IBCFile -> FilePath -> Idris ()
@@ -296,6 +298,7 @@ process reexp i fn
296 pParsedSpan $ force (ibc_parsedSpan i)
298 pParsedSpan $ force (ibc_parsedSpan i)
297 pUsage $ force (ibc_usage i)
299 pUsage $ force (ibc_usage i)
298 pExports $ force (ibc_exports i)
300 pExports $ force (ibc_exports i)
301+ pAutoHints $ force (ibc_autohints i)
300timestampOlder :: FilePath -> FilePath -> Idris ()
303timestampOlder :: FilePath -> FilePath -> Idris ()
301timestampOlder src ibc = do srct <- runIO $ getModificationTime src
304timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -326,6 +329,9 @@ pExports :: [Name] -> Idris ()
326pExports ns = do ist <- getIState
329pExports ns = do ist <- getIState
327 putIState ist { idris_exports = ns ++ idris_exports ist }
330 putIState ist { idris_exports = ns ++ idris_exports ist }
332+pAutoHints :: [(Name, Name)] -> Idris ()
333+pAutoHints ns = mapM_ (\(n,h) -> addAutoHint n h) ns
329pImportDirs :: [FilePath] -> Idris ()
335pImportDirs :: [FilePath] -> Idris ()
330pImportDirs fs = mapM_ addImportDir fs
336pImportDirs fs = mapM_ addImportDir fs
@@ -942,7 +948,7 @@ instance Binary MetaInformation where
942 _ -> error "Corrupted binary data for MetaInformation"
948 _ -> error "Corrupted binary data for MetaInformation"
944instance Binary IBCFile where
950instance Binary IBCFile where
945− 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 x38 x39 x40 x41 x42 x43 x44)
951+ 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 x38 x39 x40 x41 x42 x43 x44 x45)
946 = {-# SCC "putIBCFile" #-}
952 = {-# SCC "putIBCFile" #-}
947 do put x1
953 do put x1
@@ -988,6 +994,7 @@ instance Binary IBCFile where
993 = do x1 <- get
1000 = do x1 <- get
@@ -1035,7 +1042,8 @@ instance Binary IBCFile where
1035 x42 <- get
1042 x42 <- get
1036 x43 <- get
1043 x43 <- get
1037 x44 <- get
1044 x44 <- get
1038− 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 x38 x39 x40 x41 x42 x43 x44)
1046+ 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 x38 x39 x40 x41 x42 x43 x44 x45)
1039 else return (initIBC { ver = x1 })
1047 else return (initIBC { ver = x1 })
1041instance Binary DataOpt where
1049instance Binary DataOpt where
@@ -1072,6 +1080,7 @@ instance Binary FnOpt where
1072 Constructor -> putWord8 13
1080 Constructor -> putWord8 13
1073 CExport x1 -> do putWord8 14
1081 CExport x1 -> do putWord8 14
1083+ AutoHint -> putWord8 15
1076 = do i <- getWord8
1085 = do i <- getWord8
1077 case i of
1086 case i of
@@ -1092,6 +1101,7 @@ instance Binary FnOpt where
1092 13 -> return Constructor
1101 13 -> return Constructor
1093 14 -> do x1 <- get
1102 14 -> do x1 <- get
1094 return $ CExport x1
1103 return $ CExport x1
1104+ 15 -> return AutoHint
1095 _ -> error "Corrupted binary data for FnOpt"
1105 _ -> error "Corrupted binary data for FnOpt"
1097instance Binary Fixity where
1107instance Binary Fixity where