@@ -40,7 +40,7 @@ import System.Directory
40import Codec.Archive.Zip
40import Codec.Archive.Zip
42ibcVersion :: Word16
42ibcVersion :: Word16
43−ibcVersion = 125
43+ibcVersion = 126
45data IBCFile = IBCFile { ver :: Word16,
45data IBCFile = IBCFile { ver :: Word16,
46 sourcefile :: FilePath,
46 sourcefile :: FilePath,
@@ -86,7 +86,8 @@ data IBCFile = IBCFile { ver :: Word16,
86 ibc_parsedSpan :: !(Maybe FC),
86 ibc_parsedSpan :: !(Maybe FC),
87 ibc_usage :: ![(Name, Int)],
87 ibc_usage :: ![(Name, Int)],
88 ibc_exports :: ![Name],
88 ibc_exports :: ![Name],
89− ibc_autohints :: ![(Name, Name)]
89+ ibc_autohints :: ![(Name, Name)],
90+ ibc_deprecated :: ![(Name, String)]
91 deriving Show
92 deriving Show
@@ -94,7 +95,7 @@ deriving instance Binary IBCFile
96initIBC :: IBCFile
97initIBC :: IBCFile
97−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] [] []
98+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] Nothing [] [] [] []
99hasValidIBCVersion :: FilePath -> Idris Bool
100hasValidIBCVersion :: FilePath -> Idris Bool
100hasValidIBCVersion fp = do
101hasValidIBCVersion fp = do
@@ -179,7 +180,8 @@ entries i = catMaybes [Just $ toEntry "ver" 0 (encode $ ver i),
179 toEntry "ibc_parsedSpan" 0 . encode <$> ibc_parsedSpan i,
180 toEntry "ibc_parsedSpan" 0 . encode <$> ibc_parsedSpan i,
180 makeEntry "ibc_usage" (ibc_usage i),
181 makeEntry "ibc_usage" (ibc_usage i),
181 makeEntry "ibc_exports" (ibc_exports i),
182 makeEntry "ibc_exports" (ibc_exports i),
182− makeEntry "ibc_autohints" (ibc_autohints i)]
183+ makeEntry "ibc_autohints" (ibc_autohints i),
184+ makeEntry "ibc_deprecated" (ibc_deprecated i)]
184writeArchive :: FilePath -> IBCFile -> Idris ()
186writeArchive :: FilePath -> IBCFile -> Idris ()
185writeArchive fp i = do let a = L.foldl (\x y -> addEntryToArchive y x) emptyArchive (entries i)
187writeArchive fp i = do let a = L.foldl (\x y -> addEntryToArchive y x) emptyArchive (entries i)
@@ -305,6 +307,7 @@ ibc i (IBCModDocs n) f = case lookupCtxtExact n (idris_moduledocs i) of
305ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
307ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f }
306ibc i (IBCExport n) f = return f { ibc_exports = n : ibc_exports f }
308ibc i (IBCExport n) f = return f { ibc_exports = n : ibc_exports f }
307ibc i (IBCAutoHint n h) f = return f { ibc_autohints = (n, h) : ibc_autohints f }
309ibc i (IBCAutoHint n h) f = return f { ibc_autohints = (n, h) : ibc_autohints f }
310+ibc i (IBCDeprecate n r) f = return f { ibc_deprecated = (n, r) : ibc_deprecated f }
309getEntry :: (Binary b, NFData b) => b -> FilePath -> Archive -> Idris b
312getEntry :: (Binary b, NFData b) => b -> FilePath -> Archive -> Idris b
310getEntry alt f a = case findEntryByPath f a of
313getEntry alt f a = case findEntryByPath f a of
@@ -367,6 +370,7 @@ process reexp i fn = do
367 pUsage =<< getEntry [] "ibc_usage" i
370 pUsage =<< getEntry [] "ibc_usage" i
368 pExports =<< getEntry [] "ibc_exports" i
371 pExports =<< getEntry [] "ibc_exports" i
369 pAutoHints =<< getEntry [] "ibc_autohints" i
372 pAutoHints =<< getEntry [] "ibc_autohints" i
373+ pDeprecate =<< getEntry [] "ibc_deprecated" i
371timestampOlder :: FilePath -> FilePath -> Idris ()
375timestampOlder :: FilePath -> FilePath -> Idris ()
372timestampOlder src ibc = do srct <- runIO $ getModificationTime src
376timestampOlder src ibc = do srct <- runIO $ getModificationTime src
@@ -394,6 +398,9 @@ pExports ns = updateIState (\i -> i { idris_exports = ns ++ idris_exports i })
394pAutoHints :: [(Name, Name)] -> Idris ()
398pAutoHints :: [(Name, Name)] -> Idris ()
395pAutoHints ns = mapM_ (\(n,h) -> addAutoHint n h) ns
399pAutoHints ns = mapM_ (\(n,h) -> addAutoHint n h) ns
401+pDeprecate :: [(Name, String)] -> Idris ()
402+pDeprecate ns = mapM_ (\(n,reason) -> addDeprecated n reason) ns
397pImportDirs :: [FilePath] -> Idris ()
404pImportDirs :: [FilePath] -> Idris ()
398pImportDirs fs = mapM_ addImportDir fs
405pImportDirs fs = mapM_ addImportDir fs