ghc-9.0.0.20201227: The GHC API
Safe HaskellNone
LanguageHaskell2010

GHC.Utils.Binary

Synopsis

Documentation

data Bin a Source #

Instances

Instances details
Bounded (Bin a) # 
Instance details

Defined in GHC.Utils.Binary

Eq (Bin a) # 
Instance details

Defined in GHC.Utils.Binary

Methods

(==) :: Bin a -> Bin a -> Bool #

(/=) :: Bin a -> Bin a -> Bool #

Ord (Bin a) # 
Instance details

Defined in GHC.Utils.Binary

Methods

compare :: Bin a -> Bin a -> Ordering #

(<) :: Bin a -> Bin a -> Bool #

(<=) :: Bin a -> Bin a -> Bool #

(>) :: Bin a -> Bin a -> Bool #

(>=) :: Bin a -> Bin a -> Bool #

max :: Bin a -> Bin a -> Bin a #

min :: Bin a -> Bin a -> Bin a #

Show (Bin a) # 
Instance details

Defined in GHC.Utils.Binary

Methods

showsPrec :: Int -> Bin a -> ShowS Source #

show :: Bin a -> String Source #

showList :: [Bin a] -> ShowS Source #

Binary (Bin a) # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

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

class Binary a where Source #

Do not rely on instance sizes for general types, we use variable length encoding for many of them.

Minimal complete definition

get

Methods

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

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

get :: BinHandle -> IO a Source #

Instances

Instances details
Binary Bool # 
Instance details

Defined in GHC.Utils.Binary

Binary Char # 
Instance details

Defined in GHC.Utils.Binary

Binary Int # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO Int Source #

Binary Int8 # 
Instance details

Defined in GHC.Utils.Binary

Binary Int16 # 
Instance details

Defined in GHC.Utils.Binary

Binary Int32 # 
Instance details

Defined in GHC.Utils.Binary

Binary Int64 # 
Instance details

Defined in GHC.Utils.Binary

Binary Integer # 
Instance details

Defined in GHC.Utils.Binary

Binary Word8 # 
Instance details

Defined in GHC.Utils.Binary

Binary Word16 # 
Instance details

Defined in GHC.Utils.Binary

Binary Word32 # 
Instance details

Defined in GHC.Utils.Binary

Binary Word64 # 
Instance details

Defined in GHC.Utils.Binary

Binary RuntimeRep # 
Instance details

Defined in GHC.Utils.Binary

Binary VecCount # 
Instance details

Defined in GHC.Utils.Binary

Binary VecElem # 
Instance details

Defined in GHC.Utils.Binary

Binary SomeTypeRep # 
Instance details

Defined in GHC.Utils.Binary

Binary () # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO () Source #

Binary TyCon # 
Instance details

Defined in GHC.Utils.Binary

Binary KindRep # 
Instance details

Defined in GHC.Utils.Binary

Binary TypeLitSort # 
Instance details

Defined in GHC.Utils.Binary

Binary Fingerprint # 
Instance details

Defined in GHC.Utils.Binary

Binary ByteString # 
Instance details

Defined in GHC.Utils.Binary

Binary Serialized # 
Instance details

Defined in GHC.Utils.Binary

Binary UTCTime # 
Instance details

Defined in GHC.Utils.Binary

Binary DiffTime # 
Instance details

Defined in GHC.Utils.Binary

Binary Day # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO Day Source #

Binary IfaceBndr # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceCoercion # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceTyLit # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceTyCon # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceType # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceAppArgs # 
Instance details

Defined in GHC.Iface.Type

Binary Name #

Assumes that the Name is a non-binding one. See putIfaceTopBndr and getIfaceTopBndr for serializing binding Names. See UserData for the rationale for this distinction.

Instance details

Defined in GHC.Types.Name

Binary OccName # 
Instance details

Defined in GHC.Types.Name.Occurrence

Binary AnonArgFlag # 
Instance details

Defined in GHC.Types.Var

Binary ArgFlag # 
Instance details

Defined in GHC.Types.Var

Binary ModuleName # 
Instance details

Defined in GHC.Unit.Module.Name

Binary Unit # 
Instance details

Defined in GHC.Unit.Types

Binary UnitId # 
Instance details

Defined in GHC.Unit.Types

Binary FastString # 
Instance details

Defined in GHC.Utils.Binary

Binary UnhelpfulSpanReason # 
Instance details

Defined in GHC.Utils.Binary

Binary SrcSpan # 
Instance details

Defined in GHC.Utils.Binary

Binary BufSpan # 
Instance details

Defined in GHC.Utils.Binary

Binary RealSrcSpan # 
Instance details

Defined in GHC.Utils.Binary

Binary BufPos # 
Instance details

Defined in GHC.Utils.Binary

Binary InlineSpec # 
Instance details

Defined in GHC.Utils.Binary

Binary RuleMatchInfo # 
Instance details

Defined in GHC.Utils.Binary

Binary InlinePragma # 
Instance details

Defined in GHC.Utils.Binary

Binary Activation # 
Instance details

Defined in GHC.Utils.Binary

Binary SourceText # 
Instance details

Defined in GHC.Utils.Binary

Binary TupleSort # 
Instance details

Defined in GHC.Utils.Binary

Binary OverlapMode # 
Instance details

Defined in GHC.Utils.Binary

Binary OverlapFlag # 
Instance details

Defined in GHC.Utils.Binary

Binary RecFlag # 
Instance details

Defined in GHC.Utils.Binary

Binary FixityDirection # 
Instance details

Defined in GHC.Utils.Binary

Binary Fixity # 
Instance details

Defined in GHC.Utils.Binary

Binary WarningTxt # 
Instance details

Defined in GHC.Utils.Binary

Binary StringLiteral # 
Instance details

Defined in GHC.Utils.Binary

Binary FunctionOrData # 
Instance details

Defined in GHC.Utils.Binary

Binary PromotionFlag # 
Instance details

Defined in GHC.Utils.Binary

Binary LeftOrRight # 
Instance details

Defined in GHC.Utils.Binary

Binary BinData # 
Instance details

Defined in GHC.Utils.Binary

Binary IsBootInterface # 
Instance details

Defined in GHC.Unit.Types

Binary InstantiatedUnit # 
Instance details

Defined in GHC.Unit.Types

Binary CostCentreIndex # 
Instance details

Defined in GHC.Types.CostCentre.State

Binary NameSpace # 
Instance details

Defined in GHC.Types.Name.Occurrence

Binary CType # 
Instance details

Defined in GHC.Types.ForeignCall

Binary Header # 
Instance details

Defined in GHC.Types.ForeignCall

Binary CCallConv # 
Instance details

Defined in GHC.Types.ForeignCall

Binary CCallTarget # 
Instance details

Defined in GHC.Types.ForeignCall

Binary CCallSpec # 
Instance details

Defined in GHC.Types.ForeignCall

Binary CExportSpec # 
Instance details

Defined in GHC.Types.ForeignCall

Binary Safety # 
Instance details

Defined in GHC.Types.ForeignCall

Binary ForeignCall # 
Instance details

Defined in GHC.Types.ForeignCall

Binary CprSig # 
Instance details

Defined in GHC.Types.Cpr

Binary CprType # 
Instance details

Defined in GHC.Types.Cpr

Binary CprResult # 
Instance details

Defined in GHC.Types.Cpr

Binary HscSource # 
Instance details

Defined in GHC.Driver.Phases

Binary AvailInfo # 
Instance details

Defined in GHC.Types.Avail

Binary ArgDocMap # 
Instance details

Defined in GHC.Hs.Doc

Binary DeclDocMap # 
Instance details

Defined in GHC.Hs.Doc

Binary HsDocString # 
Instance details

Defined in GHC.Hs.Doc

Binary Specificity # 
Instance details

Defined in GHC.Types.Var

Binary CCFlavour # 
Instance details

Defined in GHC.Types.CostCentre

Binary CostCentre # 
Instance details

Defined in GHC.Types.CostCentre

Binary Role # 
Instance details

Defined in GHC.Core.Coercion.Axiom

Binary Injectivity # 
Instance details

Defined in GHC.Core.TyCon

Binary TyConBndrVis # 
Instance details

Defined in GHC.Core.TyCon

Binary IfaceUnivCoProv # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceMCoercion # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceTyConInfo # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceTyConSort # 
Instance details

Defined in GHC.Iface.Type

Binary IfaceOneShot # 
Instance details

Defined in GHC.Iface.Type

Binary LitNumType # 
Instance details

Defined in GHC.Types.Literal

Binary Literal # 
Instance details

Defined in GHC.Types.Literal

Binary SrcUnpackedness # 
Instance details

Defined in GHC.Core.DataCon

Binary SrcStrictness # 
Instance details

Defined in GHC.Core.DataCon

Binary StrictSig # 
Instance details

Defined in GHC.Types.Demand

Binary DmdType # 
Instance details

Defined in GHC.Types.Demand

Binary Divergence # 
Instance details

Defined in GHC.Types.Demand

Binary Count # 
Instance details

Defined in GHC.Types.Demand

Binary UseDmd # 
Instance details

Defined in GHC.Types.Demand

Binary StrDmd # 
Instance details

Defined in GHC.Types.Demand

Binary IsOrphan # 
Instance details

Defined in GHC.Core

Binary IfaceJoinInfo # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceLetBndr # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceBinding # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceConAlt # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceTickish # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceExpr # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceLFInfo # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceIdDetails # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceUnfolding # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceInfoItem # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceCompleteMatch # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceAnnotation # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceRule # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceFamInst # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceClsInst # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceSrcBang # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceBang # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceConDecl # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceConDecls # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceAxBranch # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceAT # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceClassOp # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceFamTyConFlav # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceTyConParent # 
Instance details

Defined in GHC.Iface.Syntax

Binary IfaceDecl # 
Instance details

Defined in GHC.Iface.Syntax

Binary ExtensibleFields # 
Instance details

Defined in GHC.Driver.Types

Binary IfaceTrustInfo # 
Instance details

Defined in GHC.Driver.Types

Binary Usage # 
Instance details

Defined in GHC.Driver.Types

Binary Dependencies # 
Instance details

Defined in GHC.Driver.Types

Binary Warnings # 
Instance details

Defined in GHC.Driver.Types

Binary ModIface # 
Instance details

Defined in GHC.Driver.Types

Binary TyVarScope # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary Scope # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary DeclType # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary BindType # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary RecFieldContext # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary IEType # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary EvBindDeps # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary EvVarSource # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary ContextInfo # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary NodeOrigin # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary HieFile # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary a => Binary [a] # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO [a] Source #

Binary a => Binary (Maybe a) # 
Instance details

Defined in GHC.Utils.Binary

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) # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO (Ratio a) Source #

Binary unit => Binary (Indefinite unit) # 
Instance details

Defined in GHC.Unit.Types

Methods

put_ :: BinHandle -> Indefinite unit -> IO () Source #

put :: BinHandle -> Indefinite unit -> IO (Bin (Indefinite unit)) Source #

get :: BinHandle -> IO (Indefinite unit) Source #

Binary a => Binary (GenModule a) # 
Instance details

Defined in GHC.Unit.Types

Binary a => Binary (Located a) # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO (Located a) Source #

Binary (DefMethSpec IfaceType) # 
Instance details

Defined in GHC.Iface.Type

Binary (FixedLengthEncoding Word8) # 
Instance details

Defined in GHC.Utils.Binary

Binary (FixedLengthEncoding Word16) # 
Instance details

Defined in GHC.Utils.Binary

Binary (FixedLengthEncoding Word32) # 
Instance details

Defined in GHC.Utils.Binary

Binary (FixedLengthEncoding Word64) # 
Instance details

Defined in GHC.Utils.Binary

Binary a => Binary (GenWithIsBoot a) # 
Instance details

Defined in GHC.Unit.Types

Binary unit => Binary (Definite unit) # 
Instance details

Defined in GHC.Unit.Types

Methods

put_ :: BinHandle -> Definite unit -> IO () Source #

put :: BinHandle -> Definite unit -> IO (Bin (Definite unit)) Source #

get :: BinHandle -> IO (Definite unit) Source #

Binary a => Binary (BooleanFormula a) # 
Instance details

Defined in GHC.Data.BooleanFormula

Binary a => Binary (FieldLbl a) # 
Instance details

Defined in GHC.Types.FieldLabel

Binary name => Binary (AnnTarget name) # 
Instance details

Defined in GHC.Types.Annotations

Methods

put_ :: BinHandle -> AnnTarget name -> IO () Source #

put :: BinHandle -> AnnTarget name -> IO (Bin (AnnTarget name)) Source #

get :: BinHandle -> IO (AnnTarget name) Source #

Binary (IdentifierDetails TypeIndex) # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary (NodeInfo TypeIndex) # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary (SourcedNodeInfo TypeIndex) # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary (HieAST TypeIndex) # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary (HieASTs TypeIndex) # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary (HieArgs TypeIndex) # 
Instance details

Defined in GHC.Iface.Ext.Types

Binary (HieType TypeIndex) # 
Instance details

Defined in GHC.Iface.Ext.Types

(Binary a, Binary b) => Binary (Either a b) # 
Instance details

Defined in GHC.Utils.Binary

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 a => Binary (TypeRep a) # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO (TypeRep a) Source #

(Binary a, Binary b) => Binary (a, b) # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO (a, b) Source #

(Ix a, Binary a, Binary b) => Binary (Array a b) # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

get :: BinHandle -> IO (Array a b) Source #

Binary (Bin a) # 
Instance details

Defined in GHC.Utils.Binary

Methods

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

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

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

(Binary tv, Binary vis) => Binary (VarBndr tv vis) # 
Instance details

Defined in GHC.Types.Var

Methods

put_ :: BinHandle -> VarBndr tv vis -> IO () Source #

put :: BinHandle -> VarBndr tv vis -> IO (Bin (VarBndr tv vis)) Source #

get :: BinHandle -> IO (VarBndr tv vis) Source #

(Binary a, Binary b, Binary c) => Binary (a, b, c) # 
Instance details

Defined in GHC.Utils.Binary

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) # 
Instance details

Defined in GHC.Utils.Binary

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) # 
Instance details

Defined in GHC.Utils.Binary

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) # 
Instance details

Defined in GHC.Utils.Binary

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) # 
Instance details

Defined in GHC.Utils.Binary

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

Constructors

BinData Int BinArray 

Instances

Instances details
NFData BinData # 
Instance details

Defined in GHC.Utils.Binary

Methods

rnf :: BinData -> () Source #

Binary BinData # 
Instance details

Defined in GHC.Utils.Binary

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

castBin :: Bin a -> Bin b 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.

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

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

For writing instances

Variable length encodings

putULEB128 :: forall a. (Integral a, FiniteBits a) => BinHandle -> a -> IO () Source #

getULEB128 :: forall a. (Integral a, FiniteBits a) => BinHandle -> IO a Source #

putSLEB128 :: forall a. (Integral a, Bits a) => BinHandle -> a -> IO () Source #

getSLEB128 :: forall a. (Show a, Integral a, FiniteBits a) => BinHandle -> IO a Source #

Fixed length encoding

newtype FixedLengthEncoding a Source #

Encode the argument in it's full length. This is different from many default binary instances which make no guarantee about the actual encoding and might do things use variable length encoding.

Constructors

FixedLengthEncoding 

Fields

Lazy Binary I/O

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 Names and FastStrings. 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 GHC.Iface.Binary).
  • 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

newReadState Source #

Arguments

:: (BinHandle -> IO Name)

how to deserialize Names

-> (BinHandle -> IO FastString) 
-> UserData 

newWriteState Source #

Arguments

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

how to serialize non-binding Names

-> (BinHandle -> Name -> IO ())

how to serialize binding Names

-> (BinHandle -> FastString -> IO ()) 
-> UserData