ghc-lib-parser-8.10.3.20201220: The GHC API, decoupled from GHC versions
Safe HaskellNone
LanguageHaskell2010

Binary

Synopsis

Documentation

data Bin a Source #

Instances

Instances details
Bounded (Bin a) Source # 
Instance details

Defined in Binary

Methods

minBound :: Bin a #

maxBound :: Bin a #

Eq (Bin a) Source # 
Instance details

Defined in Binary

Methods

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

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

Ord (Bin a) Source # 
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) Source # 
Instance details

Defined in Binary

Methods

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

show :: Bin a -> String #

showList :: [Bin a] -> ShowS #

Binary (Bin a) Source # 
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 Source # 
Instance details

Defined in Binary

Binary Char Source # 
Instance details

Defined in Binary

Binary Int Source # 
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 Source # 
Instance details

Defined in Binary

Binary Int16 Source # 
Instance details

Defined in Binary

Binary Int32 Source # 
Instance details

Defined in Binary

Binary Int64 Source # 
Instance details

Defined in Binary

Binary Integer Source # 
Instance details

Defined in Binary

Binary Word8 Source # 
Instance details

Defined in Binary

Binary Word16 Source # 
Instance details

Defined in Binary

Binary Word32 Source # 
Instance details

Defined in Binary

Binary Word64 Source # 
Instance details

Defined in Binary

Binary RuntimeRep Source # 
Instance details

Defined in Binary

Binary VecCount Source # 
Instance details

Defined in Binary

Binary VecElem Source # 
Instance details

Defined in Binary

Binary SomeTypeRep Source # 
Instance details

Defined in Binary

Binary () Source # 
Instance details

Defined in Binary

Methods

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

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

get :: BinHandle -> IO () Source #

Binary TyCon Source # 
Instance details

Defined in Binary

Binary KindRep Source # 
Instance details

Defined in Binary

Binary TypeLitSort Source # 
Instance details

Defined in Binary

Binary Fingerprint Source # 
Instance details

Defined in Binary

Binary ByteString Source # 
Instance details

Defined in Binary

Binary UTCTime Source # 
Instance details

Defined in Binary

Binary DiffTime Source # 
Instance details

Defined in Binary

Binary Day Source # 
Instance details

Defined in Binary

Methods

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

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

get :: BinHandle -> IO Day Source #

Binary Serialized Source # 
Instance details

Defined in Binary

Binary Name Source #

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

Defined in OccName

Binary FastString Source # 
Instance details

Defined in Binary

Binary ComponentId Source # 
Instance details

Defined in Module

Binary InstalledUnitId Source # 
Instance details

Defined in Module

Binary UnitId Source # 
Instance details

Defined in Module

Binary ModuleName Source # 
Instance details

Defined in Module

Binary Module Source # 
Instance details

Defined in Module

Binary SrcSpan Source # 
Instance details

Defined in Binary

Binary RealSrcSpan Source # 
Instance details

Defined in Binary

Binary InlineSpec Source # 
Instance details

Defined in Binary

Binary InlinePragma Source # 
Instance details

Defined in Binary

Binary RuleMatchInfo Source # 
Instance details

Defined in Binary

Binary Activation Source # 
Instance details

Defined in Binary

Binary SourceText Source # 
Instance details

Defined in Binary

Binary TupleSort Source # 
Instance details

Defined in Binary

Binary OverlapMode Source # 
Instance details

Defined in Binary

Binary OverlapFlag Source # 
Instance details

Defined in Binary

Binary RecFlag Source # 
Instance details

Defined in Binary

Binary FixityDirection Source # 
Instance details

Defined in Binary

Binary Fixity Source # 
Instance details

Defined in Binary

Binary WarningTxt Source # 
Instance details

Defined in Binary

Binary StringLiteral Source # 
Instance details

Defined in Binary

Binary FunctionOrData Source # 
Instance details

Defined in Binary

Binary PromotionFlag Source # 
Instance details

Defined in Binary

Binary LeftOrRight Source # 
Instance details

Defined in Binary

Binary DefUnitId Source # 
Instance details

Defined in Module

Binary IndefUnitId Source # 
Instance details

Defined in Module

Binary CType Source # 
Instance details

Defined in ForeignCall

Binary Header Source # 
Instance details

Defined in ForeignCall

Binary CCallConv Source # 
Instance details

Defined in ForeignCall

Binary CCallTarget Source # 
Instance details

Defined in ForeignCall

Binary CCallSpec Source # 
Instance details

Defined in ForeignCall

Binary CExportSpec Source # 
Instance details

Defined in ForeignCall

Binary Safety Source # 
Instance details

Defined in ForeignCall

Binary ForeignCall Source # 
Instance details

Defined in ForeignCall

Binary CostCentreIndex Source # 
Instance details

Defined in CostCentreState

Binary HscSource Source # 
Instance details

Defined in DriverPhases

Binary NameSpace Source # 
Instance details

Defined in OccName

Binary AnonArgFlag Source # 
Instance details

Defined in Var

Binary ArgFlag Source # 
Instance details

Defined in Var

Binary ArgDocMap Source # 
Instance details

Defined in GHC.Hs.Doc

Binary DeclDocMap Source # 
Instance details

Defined in GHC.Hs.Doc

Binary HsDocString Source # 
Instance details

Defined in GHC.Hs.Doc

Binary AvailInfo Source # 
Instance details

Defined in Avail

Binary IfaceBndr Source # 
Instance details

Defined in IfaceType

Binary IfaceCoercion Source # 
Instance details

Defined in IfaceType

Binary IfaceTyLit Source # 
Instance details

Defined in IfaceType

Binary IfaceTyCon Source # 
Instance details

Defined in IfaceType

Binary IfaceType Source # 
Instance details

Defined in IfaceType

Binary IfaceAppArgs Source # 
Instance details

Defined in IfaceType

Binary CCFlavour Source # 
Instance details

Defined in CostCentre

Binary CostCentre Source # 
Instance details

Defined in CostCentre

Binary Role Source # 
Instance details

Defined in CoAxiom

Binary Injectivity Source # 
Instance details

Defined in TyCon

Binary TyConBndrVis Source # 
Instance details

Defined in TyCon

Binary IfaceUnivCoProv Source # 
Instance details

Defined in IfaceType

Binary IfaceMCoercion Source # 
Instance details

Defined in IfaceType

Binary IfaceTyConInfo Source # 
Instance details

Defined in IfaceType

Binary IfaceTyConSort Source # 
Instance details

Defined in IfaceType

Binary IfaceOneShot Source # 
Instance details

Defined in IfaceType

Binary LitNumType Source # 
Instance details

Defined in Literal

Binary Literal Source # 
Instance details

Defined in Literal

Binary SrcUnpackedness Source # 
Instance details

Defined in DataCon

Binary SrcStrictness Source # 
Instance details

Defined in DataCon

Binary StrictSig Source # 
Instance details

Defined in Demand

Binary DmdType Source # 
Instance details

Defined in Demand

Binary CPRResult Source # 
Instance details

Defined in Demand

Binary DmdResult Source # 
Instance details

Defined in Demand

Binary Count Source # 
Instance details

Defined in Demand

Binary UseDmd Source # 
Instance details

Defined in Demand

Binary StrDmd Source # 
Instance details

Defined in Demand

Binary IsOrphan Source # 
Instance details

Defined in CoreSyn

Binary IfaceJoinInfo Source # 
Instance details

Defined in IfaceSyn

Binary IfaceLetBndr Source # 
Instance details

Defined in IfaceSyn

Binary IfaceBinding Source # 
Instance details

Defined in IfaceSyn

Binary IfaceConAlt Source # 
Instance details

Defined in IfaceSyn

Binary IfaceTickish Source # 
Instance details

Defined in IfaceSyn

Binary IfaceExpr Source # 
Instance details

Defined in IfaceSyn

Binary IfaceIdDetails Source # 
Instance details

Defined in IfaceSyn

Binary IfaceUnfolding Source # 
Instance details

Defined in IfaceSyn

Binary IfaceInfoItem Source # 
Instance details

Defined in IfaceSyn

Binary IfaceIdInfo Source # 
Instance details

Defined in IfaceSyn

Binary IfaceCompleteMatch Source # 
Instance details

Defined in IfaceSyn

Binary IfaceAnnotation Source # 
Instance details

Defined in IfaceSyn

Binary IfaceRule Source # 
Instance details

Defined in IfaceSyn

Binary IfaceFamInst Source # 
Instance details

Defined in IfaceSyn

Binary IfaceClsInst Source # 
Instance details

Defined in IfaceSyn

Binary IfaceSrcBang Source # 
Instance details

Defined in IfaceSyn

Binary IfaceBang Source # 
Instance details

Defined in IfaceSyn

Binary IfaceConDecl Source # 
Instance details

Defined in IfaceSyn

Binary IfaceConDecls Source # 
Instance details

Defined in IfaceSyn

Binary IfaceAxBranch Source # 
Instance details

Defined in IfaceSyn

Binary IfaceAT Source # 
Instance details

Defined in IfaceSyn

Binary IfaceClassOp Source # 
Instance details

Defined in IfaceSyn

Binary IfaceFamTyConFlav Source # 
Instance details

Defined in IfaceSyn

Binary IfaceTyConParent Source # 
Instance details

Defined in IfaceSyn

Binary IfaceDecl Source # 
Instance details

Defined in IfaceSyn

Binary IfaceTrustInfo Source # 
Instance details

Defined in HscTypes

Binary Usage Source # 
Instance details

Defined in HscTypes

Binary Dependencies Source # 
Instance details

Defined in HscTypes

Binary Warnings Source # 
Instance details

Defined in HscTypes

Binary ModIface Source # 
Instance details

Defined in HscTypes

Binary a => Binary [a] Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
Instance details

Defined in IfaceType

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

Defined in BooleanFormula

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

Defined in FieldLabel

Binary name => Binary (AnnTarget name) Source # 
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 a, Binary b) => Binary (Either a b) Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
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) Source # 
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