aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/InterfaceFile.hs
diff options
context:
space:
mode:
Diffstat (limited to 'haddock-api/src/Haddock/InterfaceFile.hs')
-rw-r--r--haddock-api/src/Haddock/InterfaceFile.hs30
1 files changed, 22 insertions, 8 deletions
diff --git a/haddock-api/src/Haddock/InterfaceFile.hs b/haddock-api/src/Haddock/InterfaceFile.hs
index d5762ce8..f45589a0 100644
--- a/haddock-api/src/Haddock/InterfaceFile.hs
+++ b/haddock-api/src/Haddock/InterfaceFile.hs
@@ -14,7 +14,7 @@
-- Reading and writing the .haddock interface file
-----------------------------------------------------------------------------
module Haddock.InterfaceFile (
- InterfaceFile(..), ifModule, ifPackageKey,
+ InterfaceFile(..), ifUnitId, ifModule,
readInterfaceFile, nameCacheFromGhc, freshNameCache, NameCacheAccessor,
writeInterfaceFile, binaryInterfaceVersion, binaryInterfaceVersionCompatibility
) where
@@ -57,8 +57,11 @@ ifModule if_ =
[] -> error "empty InterfaceFile"
iface:_ -> instMod iface
-ifPackageKey :: InterfaceFile -> PackageKey
-ifPackageKey = modulePackageKey . ifModule
+ifUnitId :: InterfaceFile -> UnitId
+ifUnitId if_ =
+ case ifInstalledIfaces if_ of
+ [] -> error "empty InterfaceFile"
+ iface:_ -> moduleUnitId $ instMod iface
binaryInterfaceMagic :: Word32
@@ -78,8 +81,8 @@ binaryInterfaceMagic = 0xD0Cface
-- (2) set `binaryInterfaceVersionCompatibility` to [binaryInterfaceVersion]
--
binaryInterfaceVersion :: Word16
-#if (__GLASGOW_HASKELL__ >= 709) && (__GLASGOW_HASKELL__ < 711)
-binaryInterfaceVersion = 27
+#if (__GLASGOW_HASKELL__ >= 711) && (__GLASGOW_HASKELL__ < 801)
+binaryInterfaceVersion = 28
binaryInterfaceVersionCompatibility :: [Word16]
binaryInterfaceVersionCompatibility = [binaryInterfaceVersion]
@@ -312,7 +315,7 @@ getSymbolTable bh namecache = do
return (namecache', arr)
-type OnDiskName = (PackageKey, ModuleName, OccName)
+type OnDiskName = (UnitId, ModuleName, OccName)
fromOnDiskName
@@ -342,7 +345,7 @@ fromOnDiskName _ nc (pid, mod_name, occ) =
serialiseName :: BinHandle -> Name -> UniqFM (Int,Name) -> IO ()
serialiseName bh name _ = do
let modu = nameModule name
- put_ bh (modulePackageKey modu, moduleName modu, nameOccName name)
+ put_ bh (moduleUnitId modu, moduleName modu, nameOccName name)
-------------------------------------------------------------------------------
@@ -470,7 +473,6 @@ instance (Binary mod, Binary id) => Binary (MetaDoc mod id) where
d <- get bh
return $ MetaDoc { _meta = m, _doc = d }
-{-* Generated by DrIFT : Look, but Don't Touch. *-}
instance (Binary mod, Binary id) => Binary (DocH mod id) where
put_ bh DocEmpty = do
putByte bh 0
@@ -535,6 +537,12 @@ instance (Binary mod, Binary id) => Binary (DocH mod id) where
put_ bh (DocHeader aa) = do
putByte bh 20
put_ bh aa
+ put_ bh (DocMathInline x) = do
+ putByte bh 21
+ put_ bh x
+ put_ bh (DocMathDisplay x) = do
+ putByte bh 22
+ put_ bh x
get bh = do
h <- getByte bh
@@ -602,6 +610,12 @@ instance (Binary mod, Binary id) => Binary (DocH mod id) where
20 -> do
aa <- get bh
return (DocHeader aa)
+ 21 -> do
+ x <- get bh
+ return (DocMathInline x)
+ 22 -> do
+ x <- get bh
+ return (DocMathDisplay x)
_ -> error "invalid binary data found in the interface file"