@@ -37,7 +37,7 @@ import Codec.Compression.Zlib (compress)
3737import Util.Zlib (decompressEither)
3838
3939ibcVersion :: Word8
40−ibcVersion = 103
40+ibcVersion = 104
4141
4242data IBCFile = IBCFile { ver :: Word8,
4343 sourcefile :: FilePath,
@@ -82,7 +82,8 @@ data IBCFile = IBCFile { ver :: Word8,
8282 ibc_externs :: ![(Name, Int)],
8383 ibc_parsedSpan :: !(Maybe FC),
8484 ibc_usage :: ![(Name, Int)],
85− ibc_exports :: ![Name]
85+ ibc_exports :: ![Name],
86+ ibc_autohints :: ![(Name, Name)]
8687 }
8788 deriving Show
8889{-!
@@ -90,7 +91,7 @@ deriving instance Binary IBCFile
9091!-}
9192
9293initIBC :: IBCFile
93−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] []
94+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] [] []
9495
9596loadIBC :: Bool -- ^ True = reexport, False = make everything private
9697 -> FilePath -> Idris ()
@@ -237,6 +238,7 @@ ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
237238 _ -> ifail "IBC write failed"
238239ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
239240ibc 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 }
240242
241243process :: Bool -- ^ Reexporting
242244 -> IBCFile -> FilePath -> Idris ()
@@ -296,6 +298,7 @@ process reexp i fn
296298 pParsedSpan $ force (ibc_parsedSpan i)
297299 pUsage $ force (ibc_usage i)
298300 pExports $ force (ibc_exports i)
301+ pAutoHints $ force (ibc_autohints i)
299302
300303timestampOlder :: FilePath -> FilePath -> Idris ()
301304timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -326,6 +329,9 @@ pExports :: [Name] -> Idris ()
326329pExports ns = do ist <- getIState
327330 putIState ist { idris_exports = ns ++ idris_exports ist }
328331
332+pAutoHints :: [(Name, Name)] -> Idris ()
333+pAutoHints ns = mapM_ (\(n,h) -> addAutoHint n h) ns
334+
329335pImportDirs :: [FilePath] -> Idris ()
330336pImportDirs fs = mapM_ addImportDir fs
331337
@@ -942,7 +948,7 @@ instance Binary MetaInformation where
942948 _ -> error "Corrupted binary data for MetaInformation"
943949
944950instance 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)
946952 = {-# SCC "putIBCFile" #-}
947953 do put x1
948954 put x2
@@ -988,6 +994,7 @@ instance Binary IBCFile where
988994 put x42
989995 put x43
990996 put x44
997+ put x45
991998
992999 get
9931000 = do x1 <- get
@@ -1035,7 +1042,8 @@ instance Binary IBCFile where
10351042 x42 <- get
10361043 x43 <- get
10371044 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)
1045+ x45 <- get
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)
10391047 else return (initIBC { ver = x1 })
10401048
10411049instance Binary DataOpt where
@@ -1072,6 +1080,7 @@ instance Binary FnOpt where
10721080 Constructor -> putWord8 13
10731081 CExport x1 -> do putWord8 14
10741082 put x1
1083+ AutoHint -> putWord8 15
10751084 get
10761085 = do i <- getWord8
10771086 case i of
@@ -1092,6 +1101,7 @@ instance Binary FnOpt where
10921101 13 -> return Constructor
10931102 14 -> do x1 <- get
10941103 return $ CExport x1
1104+ 15 -> return AutoHint
10951105 _ -> error "Corrupted binary data for FnOpt"
10961106
10971107instance Binary Fixity where