diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-01-05 19:30:24 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-01-13 18:39:25 -0500 |
commit | e1230ede3d1c77a6916e318aefcd47829e56035c (patch) | |
tree | 36b89a8d6fae359a5c5de4887c020a6101bd5cf8 /haddock-api/src/Haddock/InterfaceFile.hs | |
parent | 9a7e3d6fa3faad2ccb75f7f3e9d9f4bc203a77ca (diff) | |
parent | 99f61534a470b84c424fde0835215de6a3b6d721 (diff) |
Merge remote-tracking branch 'origin/ghc-9.0' into ghc-head
Diffstat (limited to 'haddock-api/src/Haddock/InterfaceFile.hs')
-rw-r--r-- | haddock-api/src/Haddock/InterfaceFile.hs | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/haddock-api/src/Haddock/InterfaceFile.hs b/haddock-api/src/Haddock/InterfaceFile.hs index 72fcb79b..9c34da54 100644 --- a/haddock-api/src/Haddock/InterfaceFile.hs +++ b/haddock-api/src/Haddock/InterfaceFile.hs @@ -22,12 +22,12 @@ module Haddock.InterfaceFile ( import Haddock.Types -import Haddock.Utils hiding (out) import Control.Monad +import Control.Monad.IO.Class ( MonadIO(..) ) import Data.Array import Data.IORef -import Data.List +import Data.List (mapAccumR) import qualified Data.Map as Map import Data.Map (Map) import Data.Word @@ -84,7 +84,7 @@ binaryInterfaceMagic = 0xD0Cface -- binaryInterfaceVersion :: Word16 #if MIN_VERSION_ghc(9,1,0) && !MIN_VERSION_ghc(9,2,0) -binaryInterfaceVersion = 34 +binaryInterfaceVersion = 38 binaryInterfaceVersionCompatibility :: [Word16] binaryInterfaceVersionCompatibility = [binaryInterfaceVersion] @@ -702,3 +702,28 @@ instance Binary DocName where name <- get bh return (Undocumented name) _ -> error "get DocName: Bad h" + +instance Binary n => Binary (Wrap n) where + put_ bh (Unadorned n) = do + putByte bh 0 + put_ bh n + put_ bh (Parenthesized n) = do + putByte bh 1 + put_ bh n + put_ bh (Backticked n) = do + putByte bh 2 + put_ bh n + + get bh = do + h <- getByte bh + case h of + 0 -> do + name <- get bh + return (Unadorned name) + 1 -> do + name <- get bh + return (Parenthesized name) + 2 -> do + name <- get bh + return (Backticked name) + _ -> error "get Wrap: Bad h" |