Binary

ghc-8.2.0.20170404: The GHC API

Safe Haskell | None
Language | Haskell2010

Binary (signature[?])

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 Source #

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 () Source # put :: BinHandle -> Bin k a -> IO (Bin * (Bin k a)) Source # get :: BinHandle -> IO (Bin k a) Source #

class Binary a where Source #

Minimal complete definition

get

Methods

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

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

get :: BinHandle -> IO a Source #

Instances

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

data BinHandle Source #

type SymbolTable = Array Int Name Source #

type Dictionary = Array Int FastString Source #

openBinMem :: Int -> IO BinHandle Source #

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

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

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

castBin :: Bin a -> Bin b Source #

isEOFBin :: BinHandle -> IO Bool Source #

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

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 () Source #

readBinMem :: FilePath -> IO BinHandle Source #

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

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

# For writing instances

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

getByte :: BinHandle -> IO Word8 Source #

# Lazy Binary I/O

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

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

# User data

data UserData Source #

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 Source #

setUserData :: BinHandle -> UserData -> BinHandle Source #

newReadState Source #

Arguments

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

newWriteState Source #

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 () Source #

getDictionary :: BinHandle -> IO Dictionary Source #

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