ghc-8.10.7: The GHC API
Safe HaskellNone
LanguageHaskell2010

Binary

Synopsis

Documentation

data Bin a Source #

Instances

Instances details
Bounded (Bin a) # 
Instance details

Defined in Binary

Eq (Bin a) # 
Instance details

Defined in Binary

Methods

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

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

Ord (Bin a) # 
Instance details

Defined in 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 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 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 Binary

Binary Char # 
Instance details

Defined in Binary

Binary Int # 
Instance details

Defined in 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 Binary

Binary Int16 # 
Instance details

Defined in Binary

Binary Int32 # 
Instance details

Defined in Binary

Binary Int64 # 
Instance details

Defined in Binary

Binary Integer # 
Instance details

Defined in Binary

Binary Word8 # 
Instance details

Defined in Binary

Binary Word16 # 
Instance details

Defined in Binary

Binary Word32 # 
Instance details

Defined in Binary

Binary Word64 # 
Instance details

Defined in Binary

Binary RuntimeRep # 
Instance details

Defined in Binary

Binary VecCount # 
Instance details

Defined in Binary

Binary VecElem # 
Instance details

Defined in Binary

Binary SomeTypeRep # 
Instance details

Defined in Binary

Binary () # 
Instance details

Defined in Binary

Methods

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

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

get :: BinHandle -> IO () Source #

Binary TyCon # 
Instance details

Defined in Binary

Binary KindRep # 
Instance details

Defined in Binary

Binary TypeLitSort # 
Instance details

Defined in Binary

Binary Fingerprint # 
Instance details

Defined in Binary

Binary ByteString # 
Instance details

Defined in Binary

Binary Serialized # 
Instance details

Defined in Binary

Binary UTCTime # 
Instance details

Defined in Binary

Binary DiffTime # 
Instance details

Defined in Binary

Binary Day # 
Instance details

Defined in Binary

Methods

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

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

get :: BinHandle -> IO Day Source #

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 Name

Binary OccName # 
Instance details

Defined in OccName

Binary FastString # 
Instance details

Defined in Binary

Binary ComponentId # 
Instance details

Defined in Module

Binary InstalledUnitId # 
Instance details

Defined in Module

Binary UnitId # 
Instance details

Defined in Module

Binary ModuleName # 
Instance details

Defined in Module

Binary Module # 
Instance details

Defined in Module

Binary SrcSpan # 
Instance details

Defined in Binary

Binary RealSrcSpan # 
Instance details

Defined in Binary

Binary InlineSpec # 
Instance details

Defined in Binary

Binary InlinePragma # 
Instance details

Defined in Binary

Binary RuleMatchInfo # 
Instance details

Defined in Binary

Binary Activation # 
Instance details

Defined in Binary

Binary SourceText # 
Instance details

Defined in Binary

Binary TupleSort # 
Instance details

Defined in Binary

Binary OverlapMode # 
Instance details

Defined in Binary

Binary OverlapFlag # 
Instance details

Defined in Binary

Binary RecFlag # 
Instance details

Defined in Binary

Binary FixityDirection # 
Instance details

Defined in Binary

Binary Fixity # 
Instance details

Defined in Binary

Binary WarningTxt # 
Instance details

Defined in Binary

Binary StringLiteral # 
Instance details

Defined in Binary

Binary FunctionOrData # 
Instance details

Defined in Binary

Binary PromotionFlag # 
Instance details

Defined in Binary

Binary LeftOrRight # 
Instance details

Defined in Binary

Binary PrimRep # 
Instance details

Defined in TyCon

Binary DefUnitId # 
Instance details

Defined in Module

Binary IndefUnitId # 
Instance details

Defined in Module

Binary CType # 
Instance details

Defined in ForeignCall

Binary Header # 
Instance details

Defined in ForeignCall

Binary CCallConv # 
Instance details

Defined in ForeignCall

Binary CCallTarget # 
Instance details

Defined in ForeignCall

Binary CCallSpec # 
Instance details

Defined in ForeignCall

Binary CExportSpec # 
Instance details

Defined in ForeignCall

Binary Safety # 
Instance details

Defined in ForeignCall

Binary ForeignCall # 
Instance details

Defined in ForeignCall

Binary CostCentreIndex # 
Instance details

Defined in CostCentreState

Binary HscSource # 
Instance details

Defined in DriverPhases

Binary NameSpace # 
Instance details

Defined in OccName

Binary AnonArgFlag # 
Instance details

Defined in Var

Binary ArgFlag # 
Instance details

Defined in Var

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

Defined in Avail

Binary IfaceBndr # 
Instance details

Defined in IfaceType

Binary IfaceCoercion # 
Instance details

Defined in IfaceType

Binary IfaceTyLit # 
Instance details

Defined in IfaceType

Binary IfaceTyCon # 
Instance details

Defined in IfaceType

Binary IfaceType # 
Instance details

Defined in IfaceType

Binary IfaceAppArgs # 
Instance details

Defined in IfaceType

Binary CCFlavour # 
Instance details

Defined in CostCentre

Binary CostCentre # 
Instance details

Defined in CostCentre

Binary Role # 
Instance details

Defined in CoAxiom

Binary PrimElemRep # 
Instance details

Defined in TyCon

Binary Injectivity # 
Instance details

Defined in TyCon

Binary TyConBndrVis # 
Instance details

Defined in TyCon

Binary IfaceUnivCoProv # 
Instance details

Defined in IfaceType

Binary IfaceMCoercion # 
Instance details

Defined in IfaceType

Binary IfaceTyConInfo # 
Instance details

Defined in IfaceType

Binary IfaceTyConSort # 
Instance details

Defined in IfaceType

Binary IfaceOneShot # 
Instance details

Defined in IfaceType

Binary TyVarScope # 
Instance details

Defined in HieTypes

Binary Scope # 
Instance details

Defined in HieTypes

Binary DeclType # 
Instance details

Defined in HieTypes

Binary BindType # 
Instance details

Defined in HieTypes

Binary RecFieldContext # 
Instance details

Defined in HieTypes

Binary IEType # 
Instance details

Defined in HieTypes

Binary ContextInfo # 
Instance details

Defined in HieTypes

Binary HieFile # 
Instance details

Defined in HieTypes

Binary LitNumType # 
Instance details

Defined in Literal

Binary Literal # 
Instance details

Defined in Literal

Binary SrcUnpackedness # 
Instance details

Defined in DataCon

Binary SrcStrictness # 
Instance details

Defined in DataCon

Binary StrictSig # 
Instance details

Defined in Demand

Binary DmdType # 
Instance details

Defined in Demand

Binary CPRResult # 
Instance details

Defined in Demand

Binary DmdResult # 
Instance details

Defined in Demand

Binary Count # 
Instance details

Defined in Demand

Binary UseDmd # 
Instance details

Defined in Demand

Binary StrDmd # 
Instance details

Defined in Demand

Binary IsOrphan # 
Instance details

Defined in CoreSyn

Binary IfaceJoinInfo # 
Instance details

Defined in IfaceSyn

Binary IfaceLetBndr # 
Instance details

Defined in IfaceSyn

Binary IfaceBinding # 
Instance details

Defined in IfaceSyn

Binary IfaceConAlt # 
Instance details

Defined in IfaceSyn

Binary IfaceTickish # 
Instance details

Defined in IfaceSyn

Binary IfaceExpr # 
Instance details

Defined in IfaceSyn

Binary IfaceIdDetails # 
Instance details

Defined in IfaceSyn

Binary IfaceUnfolding # 
Instance details

Defined in IfaceSyn

Binary IfaceInfoItem # 
Instance details

Defined in IfaceSyn

Binary IfaceIdInfo # 
Instance details

Defined in IfaceSyn

Binary IfaceCompleteMatch # 
Instance details

Defined in IfaceSyn

Binary IfaceAnnotation # 
Instance details

Defined in IfaceSyn

Binary IfaceRule # 
Instance details

Defined in IfaceSyn

Binary IfaceFamInst # 
Instance details

Defined in IfaceSyn

Binary IfaceClsInst # 
Instance details

Defined in IfaceSyn

Binary IfaceSrcBang # 
Instance details

Defined in IfaceSyn

Binary IfaceBang # 
Instance details

Defined in IfaceSyn

Binary IfaceConDecl # 
Instance details

Defined in IfaceSyn

Binary IfaceConDecls # 
Instance details

Defined in IfaceSyn

Binary IfaceAxBranch # 
Instance details

Defined in IfaceSyn

Binary IfaceAT # 
Instance details

Defined in IfaceSyn

Binary IfaceClassOp # 
Instance details

Defined in IfaceSyn

Binary IfaceFamTyConFlav # 
Instance details

Defined in IfaceSyn

Binary IfaceTyConParent # 
Instance details

Defined in IfaceSyn

Binary IfaceDecl # 
Instance details

Defined in IfaceSyn

Binary IfaceTrustInfo # 
Instance details

Defined in HscTypes

Binary Usage # 
Instance details

Defined in HscTypes

Binary Dependencies # 
Instance details

Defined in HscTypes

Binary Warnings # 
Instance details

Defined in HscTypes

Binary ModIface # 
Instance details

Defined in HscTypes

Binary a => Binary [a] # 
Instance details

Defined in 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 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 Binary

Methods

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

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

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

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

Defined in 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 IfaceType

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

Defined in BooleanFormula

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

Defined in FieldLabel

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

Defined in 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 HieTypes

Binary (NodeInfo TypeIndex) # 
Instance details

Defined in HieTypes

Binary (HieAST TypeIndex) # 
Instance details

Defined in HieTypes

Binary (HieASTs TypeIndex) # 
Instance details

Defined in HieTypes

Binary (HieArgs TypeIndex) # 
Instance details

Defined in HieTypes

Binary (HieType TypeIndex) # 
Instance details

Defined in HieTypes

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

Defined in 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 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 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 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 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 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 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 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 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 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 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 #

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 #

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

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