ghc-8.2.2: The GHC API

Safe Haskell | None
Language | Haskell2010

Binary

Contents

- For writing instances
- Lazy Binary I/O
- User data

Synopsis

- data Bin a
- class Binary a where
- data BinHandle
- type SymbolTable = Array Int Name
- type Dictionary = Array Int FastString
- openBinMem :: Int -> IO BinHandle
- seekBin :: BinHandle -> Bin a -> IO ()
- seekBy :: BinHandle -> Int -> IO ()
- tellBin :: BinHandle -> IO (Bin a)
- castBin :: Bin a -> Bin b
- isEOFBin :: BinHandle -> IO Bool
- withBinBuffer :: BinHandle -> (ByteString -> IO a) -> IO a
- writeBinMem :: BinHandle -> FilePath -> IO ()
- readBinMem :: FilePath -> IO BinHandle
- putAt :: Binary a => BinHandle -> Bin a -> a -> IO ()
- getAt :: Binary a => BinHandle -> Bin a -> IO a
- putByte :: BinHandle -> Word8 -> IO ()
- getByte :: BinHandle -> IO Word8
- lazyGet :: Binary a => BinHandle -> IO a
- lazyPut :: Binary a => BinHandle -> a -> IO ()
- data UserData = UserData {
  - ud_get_name :: BinHandle -> IO Name
  - ud_get_fs :: BinHandle -> IO FastString
  - ud_put_nonbinding_name :: BinHandle -> Name -> IO ()
  - ud_put_binding_name :: BinHandle -> Name -> IO ()
  - ud_put_fs :: BinHandle -> FastString -> IO ()
  }
- getUserData :: BinHandle -> UserData
- setUserData :: BinHandle -> UserData -> BinHandle
- newReadState :: (BinHandle -> IO Name) -> (BinHandle -> IO FastString) -> UserData
- newWriteState :: (BinHandle -> Name -> IO ()) -> (BinHandle -> Name -> IO ()) -> (BinHandle -> FastString -> IO ()) -> UserData
- putDictionary :: BinHandle -> Int -> UniqFM (Int, FastString) -> IO ()
- getDictionary :: BinHandle -> IO Dictionary
- putFS :: BinHandle -> FastString -> IO ()

# Documentation

data Bin a #

Instances

Bounded (Bin k a) # |
Methods minBound :: Bin k a Source # maxBound :: Bin k a Source #
Eq (Bin k a) # |
Methods (==) :: Bin k a -> Bin k a -> Bool # (/=) :: Bin k a -> Bin k a -> Bool #
Ord (Bin k a) # |
Methods compare :: Bin k a -> Bin k a -> Ordering # (<) :: Bin k a -> Bin k a -> Bool # (<=) :: Bin k a -> Bin k a -> Bool # (>) :: Bin k a -> Bin k a -> Bool # (>=) :: Bin k a -> Bin k a -> Bool # max :: Bin k a -> Bin k a -> Bin k a # min :: Bin k a -> Bin k a -> Bin k a #
Show (Bin k a) # |
Methods showsPrec :: Int -> Bin k a -> ShowS Source # show :: Bin k a -> String Source # showList :: [Bin k a] -> ShowS Source #
Binary (Bin k a) # |
Methods put_ :: BinHandle -> Bin k a -> IO () # put :: BinHandle -> Bin k a -> IO (Bin * (Bin k a)) # get :: BinHandle -> IO (Bin k a) #

class Binary a where #

Minimal complete definition

get

Methods

put_ :: BinHandle -> a -> IO () #

put :: BinHandle -> a -> IO (Bin a) #

get :: BinHandle -> IO a #

Instances

Binary Bool # |
Methods put_ :: BinHandle -> Bool -> IO () # put :: BinHandle -> Bool -> IO (Bin * Bool) # get :: BinHandle -> IO Bool #
Binary Char # |
Methods put_ :: BinHandle -> Char -> IO () # put :: BinHandle -> Char -> IO (Bin * Char) # get :: BinHandle -> IO Char #
Binary Int # |
Methods put_ :: BinHandle -> Int -> IO () # put :: BinHandle -> Int -> IO (Bin * Int) # get :: BinHandle -> IO Int #
Binary Int8 # |
Methods put_ :: BinHandle -> Int8 -> IO () # put :: BinHandle -> Int8 -> IO (Bin * Int8) # get :: BinHandle -> IO Int8 #
Binary Int16 # |
Methods put_ :: BinHandle -> Int16 -> IO () # put :: BinHandle -> Int16 -> IO (Bin * Int16) # get :: BinHandle -> IO Int16 #
Binary Int32 # |
Methods put_ :: BinHandle -> Int32 -> IO () # put :: BinHandle -> Int32 -> IO (Bin * Int32) # get :: BinHandle -> IO Int32 #
Binary Int64 # |
Methods put_ :: BinHandle -> Int64 -> IO () # put :: BinHandle -> Int64 -> IO (Bin * Int64) # get :: BinHandle -> IO Int64 #
Binary Integer # |
Methods put_ :: BinHandle -> Integer -> IO () # put :: BinHandle -> Integer -> IO (Bin * Integer) # get :: BinHandle -> IO Integer #
Binary Word8 # |
Methods put_ :: BinHandle -> Word8 -> IO () # put :: BinHandle -> Word8 -> IO (Bin * Word8) # get :: BinHandle -> IO Word8 #
Binary Word16 # |
Methods put_ :: BinHandle -> Word16 -> IO () # put :: BinHandle -> Word16 -> IO (Bin * Word16) # get :: BinHandle -> IO Word16 #
Binary Word32 # |
Methods put_ :: BinHandle -> Word32 -> IO () # put :: BinHandle -> Word32 -> IO (Bin * Word32) # get :: BinHandle -> IO Word32 #
Binary Word64 # |
Methods put_ :: BinHandle -> Word64 -> IO () # put :: BinHandle -> Word64 -> IO (Bin * Word64) # get :: BinHandle -> IO Word64 #
Binary RuntimeRep # |
Methods put_ :: BinHandle -> RuntimeRep -> IO () # put :: BinHandle -> RuntimeRep -> IO (Bin * RuntimeRep) # get :: BinHandle -> IO RuntimeRep #
Binary VecCount # |
Methods put_ :: BinHandle -> VecCount -> IO () # put :: BinHandle -> VecCount -> IO (Bin * VecCount) # get :: BinHandle -> IO VecCount #
Binary VecElem # |
Methods put_ :: BinHandle -> VecElem -> IO () # put :: BinHandle -> VecElem -> IO (Bin * VecElem) # get :: BinHandle -> IO VecElem #
Binary SomeTypeRep # |
Methods put_ :: BinHandle -> SomeTypeRep -> IO () # put :: BinHandle -> SomeTypeRep -> IO (Bin * SomeTypeRep) # get :: BinHandle -> IO SomeTypeRep #
Binary () # |
Methods put_ :: BinHandle -> () -> IO () # put :: BinHandle -> () -> IO (Bin * ()) # get :: BinHandle -> IO () #
Binary TyCon # |
Methods put_ :: BinHandle -> TyCon -> IO () # put :: BinHandle -> TyCon -> IO (Bin * TyCon) # get :: BinHandle -> IO TyCon #
Binary KindRep # |
Methods put_ :: BinHandle -> KindRep -> IO () # put :: BinHandle -> KindRep -> IO (Bin * KindRep) # get :: BinHandle -> IO KindRep #
Binary TypeLitSort # |
Methods put_ :: BinHandle -> TypeLitSort -> IO () # put :: BinHandle -> TypeLitSort -> IO (Bin * TypeLitSort) # get :: BinHandle -> IO TypeLitSort #
Binary Fingerprint # |
Methods put_ :: BinHandle -> Fingerprint -> IO () # put :: BinHandle -> Fingerprint -> IO (Bin * Fingerprint) # get :: BinHandle -> IO Fingerprint #
Binary ByteString # |
Methods put_ :: BinHandle -> ByteString -> IO () # put :: BinHandle -> ByteString -> IO (Bin * ByteString) # get :: BinHandle -> IO ByteString #
Binary UTCTime # |
Methods put_ :: BinHandle -> UTCTime -> IO () # put :: BinHandle -> UTCTime -> IO (Bin * UTCTime) # get :: BinHandle -> IO UTCTime #
Binary DiffTime # |
Methods put_ :: BinHandle -> DiffTime -> IO () # put :: BinHandle -> DiffTime -> IO (Bin * DiffTime) # get :: BinHandle -> IO DiffTime #
Binary Day # |
Methods put_ :: BinHandle -> Day -> IO () # put :: BinHandle -> Day -> IO (Bin * Day) # get :: BinHandle -> IO Day #
Binary Serialized # |
Methods put_ :: BinHandle -> Serialized -> IO () # put :: BinHandle -> Serialized -> IO (Bin * Serialized) # get :: BinHandle -> IO Serialized #
Binary Name # | Assumes that the `Name` is a non-binding one. See `putIfaceTopBndr` and `getIfaceTopBndr` for serializing binding `Name`s. See `UserData` for the rationale for this distinction.
Methods put_ :: BinHandle -> Name -> IO () # put :: BinHandle -> Name -> IO (Bin * Name) # get :: BinHandle -> IO Name #
Binary OccName # |
Methods put_ :: BinHandle -> OccName -> IO () # put :: BinHandle -> OccName -> IO (Bin * OccName) # get :: BinHandle -> IO OccName #
Binary FastString # |
Methods put_ :: BinHandle -> FastString -> IO () # put :: BinHandle -> FastString -> IO (Bin * FastString) # get :: BinHandle -> IO FastString #
Binary ComponentId # |
Methods put_ :: BinHandle -> ComponentId -> IO () # put :: BinHandle -> ComponentId -> IO (Bin * ComponentId) # get :: BinHandle -> IO ComponentId #
Binary InstalledUnitId # |
Methods put_ :: BinHandle -> InstalledUnitId -> IO () # put :: BinHandle -> InstalledUnitId -> IO (Bin * InstalledUnitId) # get :: BinHandle -> IO InstalledUnitId #
Binary UnitId # |
Methods put_ :: BinHandle -> UnitId -> IO () # put :: BinHandle -> UnitId -> IO (Bin * UnitId) # get :: BinHandle -> IO UnitId #
Binary ModuleName # |
Methods put_ :: BinHandle -> ModuleName -> IO () # put :: BinHandle -> ModuleName -> IO (Bin * ModuleName) # get :: BinHandle -> IO ModuleName #
Binary Module # |
Methods put_ :: BinHandle -> Module -> IO () # put :: BinHandle -> Module -> IO (Bin * Module) # get :: BinHandle -> IO Module #
Binary SrcSpan # |
Methods put_ :: BinHandle -> SrcSpan -> IO () # put :: BinHandle -> SrcSpan -> IO (Bin * SrcSpan) # get :: BinHandle -> IO SrcSpan #
Binary InlineSpec # |
Methods put_ :: BinHandle -> InlineSpec -> IO () # put :: BinHandle -> InlineSpec -> IO (Bin * InlineSpec) # get :: BinHandle -> IO InlineSpec #
Binary InlinePragma # |
Methods put_ :: BinHandle -> InlinePragma -> IO () # put :: BinHandle -> InlinePragma -> IO (Bin * InlinePragma) # get :: BinHandle -> IO InlinePragma #
Binary RuleMatchInfo # |
Methods put_ :: BinHandle -> RuleMatchInfo -> IO () # put :: BinHandle -> RuleMatchInfo -> IO (Bin * RuleMatchInfo) # get :: BinHandle -> IO RuleMatchInfo #
Binary Activation # |
Methods put_ :: BinHandle -> Activation -> IO () # put :: BinHandle -> Activation -> IO (Bin * Activation) # get :: BinHandle -> IO Activation #
Binary SourceText # |
Methods put_ :: BinHandle -> SourceText -> IO () # put :: BinHandle -> SourceText -> IO (Bin * SourceText) # get :: BinHandle -> IO SourceText #
Binary TupleSort # |
Methods put_ :: BinHandle -> TupleSort -> IO () # put :: BinHandle -> TupleSort -> IO (Bin * TupleSort) # get :: BinHandle -> IO TupleSort #
Binary OverlapMode # |
Methods put_ :: BinHandle -> OverlapMode -> IO () # put :: BinHandle -> OverlapMode -> IO (Bin * OverlapMode) # get :: BinHandle -> IO OverlapMode #
Binary OverlapFlag # |
Methods put_ :: BinHandle -> OverlapFlag -> IO () # put :: BinHandle -> OverlapFlag -> IO (Bin * OverlapFlag) # get :: BinHandle -> IO OverlapFlag #
Binary RecFlag # |
Methods put_ :: BinHandle -> RecFlag -> IO () # put :: BinHandle -> RecFlag -> IO (Bin * RecFlag) # get :: BinHandle -> IO RecFlag #
Binary FixityDirection # |
Methods put_ :: BinHandle -> FixityDirection -> IO () # put :: BinHandle -> FixityDirection -> IO (Bin * FixityDirection) # get :: BinHandle -> IO FixityDirection #
Binary Fixity # |
Methods put_ :: BinHandle -> Fixity -> IO () # put :: BinHandle -> Fixity -> IO (Bin * Fixity) # get :: BinHandle -> IO Fixity #
Binary WarningTxt # |
Methods put_ :: BinHandle -> WarningTxt -> IO () # put :: BinHandle -> WarningTxt -> IO (Bin * WarningTxt) # get :: BinHandle -> IO WarningTxt #
Binary StringLiteral # |
Methods put_ :: BinHandle -> StringLiteral -> IO () # put :: BinHandle -> StringLiteral -> IO (Bin * StringLiteral) # get :: BinHandle -> IO StringLiteral #
Binary FunctionOrData # |
Methods put_ :: BinHandle -> FunctionOrData -> IO () # put :: BinHandle -> FunctionOrData -> IO (Bin * FunctionOrData) # get :: BinHandle -> IO FunctionOrData #
Binary LeftOrRight # |
Methods put_ :: BinHandle -> LeftOrRight -> IO () # put :: BinHandle -> LeftOrRight -> IO (Bin * LeftOrRight) # get :: BinHandle -> IO LeftOrRight #
Binary DefUnitId # |
Methods put_ :: BinHandle -> DefUnitId -> IO () # put :: BinHandle -> DefUnitId -> IO (Bin * DefUnitId) # get :: BinHandle -> IO DefUnitId #
Binary IndefUnitId # |
Methods put_ :: BinHandle -> IndefUnitId -> IO () # put :: BinHandle -> IndefUnitId -> IO (Bin * IndefUnitId) # get :: BinHandle -> IO IndefUnitId #
Binary CType # |
Methods put_ :: BinHandle -> CType -> IO () # put :: BinHandle -> CType -> IO (Bin * CType) # get :: BinHandle -> IO CType #
Binary Header # |
Methods put_ :: BinHandle -> Header -> IO () # put :: BinHandle -> Header -> IO (Bin * Header) # get :: BinHandle -> IO Header #
Binary CCallConv # |
Methods put_ :: BinHandle -> CCallConv -> IO () # put :: BinHandle -> CCallConv -> IO (Bin * CCallConv) # get :: BinHandle -> IO CCallConv #
Binary CCallTarget # |
Methods put_ :: BinHandle -> CCallTarget -> IO () # put :: BinHandle -> CCallTarget -> IO (Bin * CCallTarget) # get :: BinHandle -> IO CCallTarget #
Binary CCallSpec # |
Methods put_ :: BinHandle -> CCallSpec -> IO () # put :: BinHandle -> CCallSpec -> IO (Bin * CCallSpec) # get :: BinHandle -> IO CCallSpec #
Binary CExportSpec # |
Methods put_ :: BinHandle -> CExportSpec -> IO () # put :: BinHandle -> CExportSpec -> IO (Bin * CExportSpec) # get :: BinHandle -> IO CExportSpec #
Binary Safety # |
Methods put_ :: BinHandle -> Safety -> IO () # put :: BinHandle -> Safety -> IO (Bin * Safety) # get :: BinHandle -> IO Safety #
Binary ForeignCall # |
Methods put_ :: BinHandle -> ForeignCall -> IO () # put :: BinHandle -> ForeignCall -> IO (Bin * ForeignCall) # get :: BinHandle -> IO ForeignCall #
Binary HscSource # |
Methods put_ :: BinHandle -> HscSource -> IO () # put :: BinHandle -> HscSource -> IO (Bin * HscSource) # get :: BinHandle -> IO HscSource #
Binary NameSpace # |
Methods put_ :: BinHandle -> NameSpace -> IO () # put :: BinHandle -> NameSpace -> IO (Bin * NameSpace) # get :: BinHandle -> IO NameSpace #
Binary AvailInfo # |
Methods put_ :: BinHandle -> AvailInfo -> IO () # put :: BinHandle -> AvailInfo -> IO (Bin * AvailInfo) # get :: BinHandle -> IO AvailInfo #
Binary ArgFlag # |
Methods put_ :: BinHandle -> ArgFlag -> IO () # put :: BinHandle -> ArgFlag -> IO (Bin * ArgFlag) # get :: BinHandle -> IO ArgFlag #
Binary IsCafCC # |
Methods put_ :: BinHandle -> IsCafCC -> IO () # put :: BinHandle -> IsCafCC -> IO (Bin * IsCafCC) # get :: BinHandle -> IO IsCafCC #
Binary CostCentre # |
Methods put_ :: BinHandle -> CostCentre -> IO () # put :: BinHandle -> CostCentre -> IO (Bin * CostCentre) # get :: BinHandle -> IO CostCentre #
Binary Role # |
Methods put_ :: BinHandle -> Role -> IO () # put :: BinHandle -> Role -> IO (Bin * Role) # get :: BinHandle -> IO Role #
Binary Injectivity # |
Methods put_ :: BinHandle -> Injectivity -> IO () # put :: BinHandle -> Injectivity -> IO (Bin * Injectivity) # get :: BinHandle -> IO Injectivity #
Binary TyConBndrVis # |
Methods put_ :: BinHandle -> TyConBndrVis -> IO () # put :: BinHandle -> TyConBndrVis -> IO (Bin * TyConBndrVis) # get :: BinHandle -> IO TyConBndrVis #
Binary IfaceTcArgs # |
Methods put_ :: BinHandle -> IfaceTcArgs -> IO () # put :: BinHandle -> IfaceTcArgs -> IO (Bin * IfaceTcArgs) # get :: BinHandle -> IO IfaceTcArgs #
Binary IfaceCoercion # |
Methods put_ :: BinHandle -> IfaceCoercion -> IO () # put :: BinHandle -> IfaceCoercion -> IO (Bin * IfaceCoercion) # get :: BinHandle -> IO IfaceCoercion #
Binary IfaceTyLit # |
Methods put_ :: BinHandle -> IfaceTyLit -> IO () # put :: BinHandle -> IfaceTyLit -> IO (Bin * IfaceTyLit) # get :: BinHandle -> IO IfaceTyLit #
Binary IfaceTyCon # |
Methods put_ :: BinHandle -> IfaceTyCon -> IO () # put :: BinHandle -> IfaceTyCon -> IO (Bin * IfaceTyCon) # get :: BinHandle -> IO IfaceTyCon #
Binary IfaceType # |
Methods put_ :: BinHandle -> IfaceType -> IO () # put :: BinHandle -> IfaceType -> IO (Bin * IfaceType) # get :: BinHandle -> IO IfaceType #
Binary IfaceUnivCoProv # |
Methods put_ :: BinHandle -> IfaceUnivCoProv -> IO () # put :: BinHandle -> IfaceUnivCoProv -> IO (Bin * IfaceUnivCoProv) # get :: BinHandle -> IO IfaceUnivCoProv #
Binary IfaceTyConInfo # |
Methods put_ :: BinHandle -> IfaceTyConInfo -> IO () # put :: BinHandle -> IfaceTyConInfo -> IO (Bin * IfaceTyConInfo) # get :: BinHandle -> IO IfaceTyConInfo #
Binary IfaceTyConSort # |
Methods put_ :: BinHandle -> IfaceTyConSort -> IO () # put :: BinHandle -> IfaceTyConSort -> IO (Bin * IfaceTyConSort) # get :: BinHandle -> IO IfaceTyConSort #
Binary IsPromoted # |
Methods put_ :: BinHandle -> IsPromoted -> IO () # put :: BinHandle -> IsPromoted -> IO (Bin * IsPromoted) # get :: BinHandle -> IO IsPromoted #
Binary IfaceOneShot # |
Methods put_ :: BinHandle -> IfaceOneShot -> IO () # put :: BinHandle -> IfaceOneShot -> IO (Bin * IfaceOneShot) # get :: BinHandle -> IO IfaceOneShot #
Binary IfaceBndr # |
Methods put_ :: BinHandle -> IfaceBndr -> IO () # put :: BinHandle -> IfaceBndr -> IO (Bin * IfaceBndr) # get :: BinHandle -> IO IfaceBndr #
Binary Literal # |
Methods put_ :: BinHandle -> Literal -> IO () # put :: BinHandle -> Literal -> IO (Bin * Literal) # get :: BinHandle -> IO Literal #
Binary SrcUnpackedness # |
Methods put_ :: BinHandle -> SrcUnpackedness -> IO () # put :: BinHandle -> SrcUnpackedness -> IO (Bin * SrcUnpackedness) # get :: BinHandle -> IO SrcUnpackedness #
Binary SrcStrictness # |
Methods put_ :: BinHandle -> SrcStrictness -> IO () # put :: BinHandle -> SrcStrictness -> IO (Bin * SrcStrictness) # get :: BinHandle -> IO SrcStrictness #
Binary StrictSig # |
Methods put_ :: BinHandle -> StrictSig -> IO () # put :: BinHandle -> StrictSig -> IO (Bin * StrictSig) # get :: BinHandle -> IO StrictSig #
Binary DmdType # |
Methods put_ :: BinHandle -> DmdType -> IO () # put :: BinHandle -> DmdType -> IO (Bin * DmdType) # get :: BinHandle -> IO DmdType #
Binary CPRResult # |
Methods put_ :: BinHandle -> CPRResult -> IO () # put :: BinHandle -> CPRResult -> IO (Bin * CPRResult) # get :: BinHandle -> IO CPRResult #
Binary DmdResult # |
Methods put_ :: BinHandle -> DmdResult -> IO () # put :: BinHandle -> DmdResult -> IO (Bin * DmdResult) # get :: BinHandle -> IO DmdResult #
Binary Count # |
Methods put_ :: BinHandle -> Count -> IO () # put :: BinHandle -> Count -> IO (Bin * Count) # get :: BinHandle -> IO Count #
Binary UseDmd # |
Methods put_ :: BinHandle -> UseDmd -> IO () # put :: BinHandle -> UseDmd -> IO (Bin * UseDmd) # get :: BinHandle -> IO UseDmd #
Binary StrDmd # |
Methods put_ :: BinHandle -> StrDmd -> IO () # put :: BinHandle -> StrDmd -> IO (Bin * StrDmd) # get :: BinHandle -> IO StrDmd #
Binary IsOrphan # |
Methods put_ :: BinHandle -> IsOrphan -> IO () # put :: BinHandle -> IsOrphan -> IO (Bin * IsOrphan) # get :: BinHandle -> IO IsOrphan #
Binary IfaceJoinInfo # |
Methods put_ :: BinHandle -> IfaceJoinInfo -> IO () # put :: BinHandle -> IfaceJoinInfo -> IO (Bin * IfaceJoinInfo) # get :: BinHandle -> IO IfaceJoinInfo #
Binary IfaceLetBndr # |
Methods put_ :: BinHandle -> IfaceLetBndr -> IO () # put :: BinHandle -> IfaceLetBndr -> IO (Bin * IfaceLetBndr) # get :: BinHandle -> IO IfaceLetBndr #
Binary IfaceBinding # |
Methods put_ :: BinHandle -> IfaceBinding -> IO () # put :: BinHandle -> IfaceBinding -> IO (Bin * IfaceBinding) # get :: BinHandle -> IO IfaceBinding #
Binary IfaceConAlt # |
Methods put_ :: BinHandle -> IfaceConAlt -> IO () # put :: BinHandle -> IfaceConAlt -> IO (Bin * IfaceConAlt) # get :: BinHandle -> IO IfaceConAlt #
Binary IfaceTickish # |
Methods put_ :: BinHandle -> IfaceTickish -> IO () # put :: BinHandle -> IfaceTickish -> IO (Bin * IfaceTickish) # get :: BinHandle -> IO IfaceTickish #
Binary IfaceExpr # |
Methods put_ :: BinHandle -> IfaceExpr -> IO () # put :: BinHandle -> IfaceExpr -> IO (Bin * IfaceExpr) # get :: BinHandle -> IO IfaceExpr #
Binary IfaceIdDetails # |
Methods put_ :: BinHandle -> IfaceIdDetails -> IO () # put :: BinHandle -> IfaceIdDetails -> IO (Bin * IfaceIdDetails) # get :: BinHandle -> IO IfaceIdDetails #
Binary IfaceUnfolding # |
Methods put_ :: BinHandle -> IfaceUnfolding -> IO () # put :: BinHandle -> IfaceUnfolding -> IO (Bin * IfaceUnfolding) # get :: BinHandle -> IO IfaceUnfolding #
Binary IfaceInfoItem # |
Methods put_ :: BinHandle -> IfaceInfoItem -> IO () # put :: BinHandle -> IfaceInfoItem -> IO (Bin * IfaceInfoItem) # get :: BinHandle -> IO IfaceInfoItem #
Binary IfaceIdInfo # |
Methods put_ :: BinHandle -> IfaceIdInfo -> IO () # put :: BinHandle -> IfaceIdInfo -> IO (Bin * IfaceIdInfo) # get :: BinHandle -> IO IfaceIdInfo #
Binary IfaceCompleteMatch # |
Methods put_ :: BinHandle -> IfaceCompleteMatch -> IO () # put :: BinHandle -> IfaceCompleteMatch -> IO (Bin * IfaceCompleteMatch) # get :: BinHandle -> IO IfaceCompleteMatch #
Binary IfaceAnnotation # |
Methods put_ :: BinHandle -> IfaceAnnotation -> IO () # put :: BinHandle -> IfaceAnnotation -> IO (Bin * IfaceAnnotation) # get :: BinHandle -> IO IfaceAnnotation #
Binary IfaceRule # |
Methods put_ :: BinHandle -> IfaceRule -> IO () # put :: BinHandle -> IfaceRule -> IO (Bin * IfaceRule) # get :: BinHandle -> IO IfaceRule #
Binary IfaceFamInst # |
Methods put_ :: BinHandle -> IfaceFamInst -> IO () # put :: BinHandle -> IfaceFamInst -> IO (Bin * IfaceFamInst) # get :: BinHandle -> IO IfaceFamInst #
Binary IfaceClsInst # |
Methods put_ :: BinHandle -> IfaceClsInst -> IO () # put :: BinHandle -> IfaceClsInst -> IO (Bin * IfaceClsInst) # get :: BinHandle -> IO IfaceClsInst #
Binary IfaceSrcBang # |
Methods put_ :: BinHandle -> IfaceSrcBang -> IO () # put :: BinHandle -> IfaceSrcBang -> IO (Bin * IfaceSrcBang) # get :: BinHandle -> IO IfaceSrcBang #
Binary IfaceBang # |
Methods put_ :: BinHandle -> IfaceBang -> IO () # put :: BinHandle -> IfaceBang -> IO (Bin * IfaceBang) # get :: BinHandle -> IO IfaceBang #
Binary IfaceConDecl # |
Methods put_ :: BinHandle -> IfaceConDecl -> IO () # put :: BinHandle -> IfaceConDecl -> IO (Bin * IfaceConDecl) # get :: BinHandle -> IO IfaceConDecl #
Binary IfaceConDecls # |
Methods put_ :: BinHandle -> IfaceConDecls -> IO () # put :: BinHandle -> IfaceConDecls -> IO (Bin * IfaceConDecls) # get :: BinHandle -> IO IfaceConDecls #
Binary IfaceAxBranch # |
Methods put_ :: BinHandle -> IfaceAxBranch -> IO () # put :: BinHandle -> IfaceAxBranch -> IO (Bin * IfaceAxBranch) # get :: BinHandle -> IO IfaceAxBranch #
Binary IfaceAT # |
Methods put_ :: BinHandle -> IfaceAT -> IO () # put :: BinHandle -> IfaceAT -> IO (Bin * IfaceAT) # get :: BinHandle -> IO IfaceAT #
Binary IfaceClassOp # |
Methods put_ :: BinHandle -> IfaceClassOp -> IO () # put :: BinHandle -> IfaceClassOp -> IO (Bin * IfaceClassOp) # get :: BinHandle -> IO IfaceClassOp #
Binary IfaceFamTyConFlav # |
Methods put_ :: BinHandle -> IfaceFamTyConFlav -> IO () # put :: BinHandle -> IfaceFamTyConFlav -> IO (Bin * IfaceFamTyConFlav) # get :: BinHandle -> IO IfaceFamTyConFlav #
Binary IfaceTyConParent # |
Methods put_ :: BinHandle -> IfaceTyConParent -> IO () # put :: BinHandle -> IfaceTyConParent -> IO (Bin * IfaceTyConParent) # get :: BinHandle -> IO IfaceTyConParent #
Binary IfaceDecl # |
Methods put_ :: BinHandle -> IfaceDecl -> IO () # put :: BinHandle -> IfaceDecl -> IO (Bin * IfaceDecl) # get :: BinHandle -> IO IfaceDecl #
Binary IfaceTrustInfo # |
Methods put_ :: BinHandle -> IfaceTrustInfo -> IO () # put :: BinHandle -> IfaceTrustInfo -> IO (Bin * IfaceTrustInfo) # get :: BinHandle -> IO IfaceTrustInfo #
Binary IfaceVectInfo # |
Methods put_ :: BinHandle -> IfaceVectInfo -> IO () # put :: BinHandle -> IfaceVectInfo -> IO (Bin * IfaceVectInfo) # get :: BinHandle -> IO IfaceVectInfo #
Binary Usage # |
Methods put_ :: BinHandle -> Usage -> IO () # put :: BinHandle -> Usage -> IO (Bin * Usage) # get :: BinHandle -> IO Usage #
Binary Dependencies # |
Methods put_ :: BinHandle -> Dependencies -> IO () # put :: BinHandle -> Dependencies -> IO (Bin * Dependencies) # get :: BinHandle -> IO Dependencies #
Binary Warnings # |
Methods put_ :: BinHandle -> Warnings -> IO () # put :: BinHandle -> Warnings -> IO (Bin * Warnings) # get :: BinHandle -> IO Warnings #
Binary ModIface # |
Methods put_ :: BinHandle -> ModIface -> IO () # put :: BinHandle -> ModIface -> IO (Bin * ModIface) # get :: BinHandle -> IO ModIface #
Binary a => Binary [a] # |
Methods put_ :: BinHandle -> [a] -> IO () # put :: BinHandle -> [a] -> IO (Bin * [a]) # get :: BinHandle -> IO [a] #
Binary a => Binary (Maybe a) # |
Methods put_ :: BinHandle -> Maybe a -> IO () # put :: BinHandle -> Maybe a -> IO (Bin * (Maybe a)) # get :: BinHandle -> IO (Maybe a) #
Binary a => Binary (Ratio a) # |
Methods put_ :: BinHandle -> Ratio a -> IO () # put :: BinHandle -> Ratio a -> IO (Bin * (Ratio a)) # get :: BinHandle -> IO (Ratio a) #
Binary (DefMethSpec IfaceType) # |
Methods put_ :: BinHandle -> DefMethSpec IfaceType -> IO () # put :: BinHandle -> DefMethSpec IfaceType -> IO (Bin * (DefMethSpec IfaceType)) # get :: BinHandle -> IO (DefMethSpec IfaceType) #
Binary a => Binary (BooleanFormula a) # |
Methods put_ :: BinHandle -> BooleanFormula a -> IO () # put :: BinHandle -> BooleanFormula a -> IO (Bin * (BooleanFormula a)) # get :: BinHandle -> IO (BooleanFormula a) #
Binary a => Binary (FieldLbl a) # |
Methods put_ :: BinHandle -> FieldLbl a -> IO () # put :: BinHandle -> FieldLbl a -> IO (Bin * (FieldLbl a)) # get :: BinHandle -> IO (FieldLbl a) #
Binary name => Binary (AnnTarget name) # |
Methods put_ :: BinHandle -> AnnTarget name -> IO () # put :: BinHandle -> AnnTarget name -> IO (Bin * (AnnTarget name)) # get :: BinHandle -> IO (AnnTarget name) #
(Binary a, Binary b) => Binary (Either a b) # |
Methods put_ :: BinHandle -> Either a b -> IO () # put :: BinHandle -> Either a b -> IO (Bin * (Either a b)) # get :: BinHandle -> IO (Either a b) #
Typeable k a => Binary (TypeRep k a) # |
Methods put_ :: BinHandle -> TypeRep k a -> IO () # put :: BinHandle -> TypeRep k a -> IO (Bin * (TypeRep k a)) # get :: BinHandle -> IO (TypeRep k a) #
(Binary a, Binary b) => Binary (a, b) # |
Methods put_ :: BinHandle -> (a, b) -> IO () # put :: BinHandle -> (a, b) -> IO (Bin * (a, b)) # get :: BinHandle -> IO (a, b) #
Binary a => Binary (GenLocated SrcSpan a) # |
Methods put_ :: BinHandle -> GenLocated SrcSpan a -> IO () # put :: BinHandle -> GenLocated SrcSpan a -> IO (Bin * (GenLocated SrcSpan a)) # get :: BinHandle -> IO (GenLocated SrcSpan a) #
Binary (Bin k a) # |
Methods put_ :: BinHandle -> Bin k a -> IO () # put :: BinHandle -> Bin k a -> IO (Bin * (Bin k a)) # get :: BinHandle -> IO (Bin k a) #
(Binary tv, Binary vis) => Binary (TyVarBndr tv vis) # |
Methods put_ :: BinHandle -> TyVarBndr tv vis -> IO () # put :: BinHandle -> TyVarBndr tv vis -> IO (Bin * (TyVarBndr tv vis)) # get :: BinHandle -> IO (TyVarBndr tv vis) #
(Binary a, Binary b, Binary c) => Binary (a, b, c) # |
Methods put_ :: BinHandle -> (a, b, c) -> IO () # put :: BinHandle -> (a, b, c) -> IO (Bin * (a, b, c)) # get :: BinHandle -> IO (a, b, c) #
(Binary a, Binary b, Binary c, Binary d) => Binary (a, b, c, d) # |
Methods put_ :: BinHandle -> (a, b, c, d) -> IO () # put :: BinHandle -> (a, b, c, d) -> IO (Bin * (a, b, c, d)) # get :: BinHandle -> IO (a, b, c, d) #
(Binary a, Binary b, Binary c, Binary d, Binary e) => Binary (a, b, c, d, e) # |
Methods put_ :: BinHandle -> (a, b, c, d, e) -> IO () # put :: BinHandle -> (a, b, c, d, e) -> IO (Bin * (a, b, c, d, e)) # get :: BinHandle -> IO (a, b, c, d, e) #
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f) => Binary (a, b, c, d, e, f) # |
Methods put_ :: BinHandle -> (a, b, c, d, e, f) -> IO () # put :: BinHandle -> (a, b, c, d, e, f) -> IO (Bin * (a, b, c, d, e, f)) # get :: BinHandle -> IO (a, b, c, d, e, f) #
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g) => Binary (a, b, c, d, e, f, g) # |
Methods put_ :: BinHandle -> (a, b, c, d, e, f, g) -> IO () # put :: BinHandle -> (a, b, c, d, e, f, g) -> IO (Bin * (a, b, c, d, e, f, g)) # get :: BinHandle -> IO (a, b, c, d, e, f, g) #

data BinHandle #

type SymbolTable = Array Int Name #

type Dictionary = Array Int FastString #

openBinMem :: Int -> IO BinHandle #

seekBin :: BinHandle -> Bin a -> IO () #

seekBy :: BinHandle -> Int -> IO () #

tellBin :: BinHandle -> IO (Bin a) #

castBin :: Bin a -> Bin b #

isEOFBin :: BinHandle -> IO Bool #

withBinBuffer :: BinHandle -> (ByteString -> IO a) -> IO a #

Get access to the underlying buffer.

It is quite important that no references to the `ByteString` leak out of the continuation lest terrible things happen.

writeBinMem :: BinHandle -> FilePath -> IO () #

readBinMem :: FilePath -> IO BinHandle #

putAt :: Binary a => BinHandle -> Bin a -> a -> IO () #

getAt :: Binary a => BinHandle -> Bin a -> IO a #

# For writing instances

putByte :: BinHandle -> Word8 -> IO () #

getByte :: BinHandle -> IO Word8 #

# Lazy Binary I/O

lazyGet :: Binary a => BinHandle -> IO a #

lazyPut :: Binary a => BinHandle -> a -> IO () #

# User data

data UserData #

Information we keep around during interface file serialization/deserialization. Namely we keep the functions for serializing and deserializing `Name`s and `FastString`s. We do this because we actually use serialization in two distinct settings,

- When serializing interface files themselves
- When computing the fingerprint of an IfaceDecl (which we computing by hashing its Binary serialization)

These two settings have different needs while serializing Names:

- Names in interface files are serialized via a symbol table (see Note [Symbol table representation of names] in BinIface).
- During fingerprinting a binding Name is serialized as the OccName and a non-binding Name is serialized as the fingerprint of the thing they represent. See Note [Fingerprinting IfaceDecls] for further discussion.

Constructors

UserData |

Fields

- ud_get_name :: BinHandle -> IO Name
- ud_get_fs :: BinHandle -> IO FastString
- ud_put_nonbinding_name :: BinHandle -> Name -> IO ()

  serialize a non-binding `Name` (e.g. a reference to another binding).

- ud_put_binding_name :: BinHandle -> Name -> IO ()

  serialize a binding `Name` (e.g. the name of an IfaceDecl)

- ud_put_fs :: BinHandle -> FastString -> IO ()

getUserData :: BinHandle -> UserData #

setUserData :: BinHandle -> UserData -> BinHandle #

newReadState #

Arguments

:: (BinHandle -> IO Name) | how to deserialize `Name`s
-> (BinHandle -> IO FastString) |
-> UserData |

newWriteState #

Arguments

:: (BinHandle -> Name -> IO ()) | how to serialize non-binding `Name`s
-> (BinHandle -> Name -> IO ()) | how to serialize binding `Name`s
-> (BinHandle -> FastString -> IO ()) |
-> UserData |

putDictionary :: BinHandle -> Int -> UniqFM (Int, FastString) -> IO () #

getDictionary :: BinHandle -> IO Dictionary #

putFS :: BinHandle -> FastString -> IO () #