diff options
author | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2009-08-23 07:26:05 +0000 |
---|---|---|
committer | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2009-08-23 07:26:05 +0000 |
commit | 7d06f667278dde53285b1abc72701f11f0cccd6f (patch) | |
tree | 130a6ec2a06b925b995866b07596753a10d6343a /src/Haddock/InterfaceFile.hs | |
parent | 3a51468aabab2a3f4b9e06e7e0025f2421e07469 (diff) |
cross-package fnArgDocs. WARNING: changes .haddock binary format
While breaking the format, I took the opportunity to unrename the
DocMap that's saved to disk, because there's really no reason that
we want to know what *another* package's favorite place to link a
Name to was. (Is that true? Or might we want to know, someday?)
Also, I added instance Binary Map in InterfaceFile.
It makes the code a little simpler without changing anything of
substance. Also it lets us add another Map hidden inside another
Map (fnArgsDocs in instDocMap) without having really-convoluted
serialization code. Instances are neat!
I don't understand why this change to InterfaceFile seemed to
subtly break binary compatibility all by itself, but no matter,
I'll just roll it into the greater format-changing patch. Done!
Diffstat (limited to 'src/Haddock/InterfaceFile.hs')
-rw-r--r-- | src/Haddock/InterfaceFile.hs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/Haddock/InterfaceFile.hs b/src/Haddock/InterfaceFile.hs index 81361997..083735c1 100644 --- a/src/Haddock/InterfaceFile.hs +++ b/src/Haddock/InterfaceFile.hs @@ -27,6 +27,7 @@ import Data.Word import Data.Array import Data.IORef import qualified Data.Map as Map +import Data.Map (Map) import GHC hiding (NoLink) import Binary @@ -56,9 +57,9 @@ binaryInterfaceMagic = 0xD0Cface -- we version our interface files accordingly. binaryInterfaceVersion :: Word16 #if __GLASGOW_HASKELL__ == 610 -binaryInterfaceVersion = 12 +binaryInterfaceVersion = 14 #elif __GLASGOW_HASKELL__ == 611 -binaryInterfaceVersion = 13 +binaryInterfaceVersion = 15 #endif @@ -332,27 +333,33 @@ serialiseName bh name _ = do -- GhcBinary instances ------------------------------------------------------------------------------- +-- Hmm, why didn't we dare to make this instance already? It makes things +-- much easier. +instance (Ord k, Binary k, Binary v) => Binary (Map k v) where + put_ bh m = put_ bh (Map.toAscList m) + get bh = fmap (Map.fromAscList) (get bh) + instance Binary InterfaceFile where put_ bh (InterfaceFile env ifaces) = do - put_ bh (Map.toList env) + put_ bh env put_ bh ifaces get bh = do env <- get bh ifaces <- get bh - return (InterfaceFile (Map.fromList env) ifaces) + return (InterfaceFile env ifaces) instance Binary InstalledInterface where put_ bh (InstalledInterface modu info docMap exps visExps opts subMap) = do put_ bh modu put_ bh info - put_ bh (Map.toList docMap) + put_ bh docMap put_ bh exps put_ bh visExps put_ bh opts - put_ bh (Map.toList subMap) + put_ bh subMap get bh = do modu <- get bh @@ -363,8 +370,8 @@ instance Binary InstalledInterface where opts <- get bh subMap <- get bh - return (InstalledInterface modu info (Map.fromList docMap) - exps visExps opts (Map.fromList subMap)) + return (InstalledInterface modu info docMap + exps visExps opts subMap) instance Binary DocOption where |