ghc-8.4.0.20180118: The GHC API

Safe HaskellNone
LanguageHaskell2010

Binary

Contents

Synopsis

Documentation

data Bin a Source #

Instances
Bounded (Bin a) # 
Instance details
Eq (Bin a) # 
Instance details

Methods

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

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

Ord (Bin a) # 
Instance details

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

Methods

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

show :: Bin a -> String Source #

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

Binary (Bin a) # 
Instance details

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 #

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

Methods

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

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

get :: BinHandle -> IO Int Source #

Binary Int8 # 
Instance details
Binary Int16 # 
Instance details
Binary Int32 # 
Instance details
Binary Int64 # 
Instance details
Binary Integer # 
Instance details
Binary Word8 # 
Instance details
Binary Word16 # 
Instance details
Binary Word32 # 
Instance details
Binary Word64 # 
Instance details
Binary RuntimeRep # 
Instance details
Binary VecCount # 
Instance details
Binary VecElem # 
Instance details
Binary SomeTypeRep # 
Instance details
Binary () # 
Instance details

Methods

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

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

get :: BinHandle -> IO () Source #

Binary TyCon # 
Instance details
Binary KindRep # 
Instance details
Binary TypeLitSort # 
Instance details
Binary Fingerprint # 
Instance details
Binary ByteString # 
Instance details
Binary UTCTime # 
Instance details
Binary DiffTime # 
Instance details
Binary Day # 
Instance details

Methods

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

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

get :: BinHandle -> IO Day Source #

Binary Serialized # 
Instance details
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
Binary OccName # 
Instance details
Binary FastString # 
Instance details
Binary ComponentId # 
Instance details
Binary InstalledUnitId # 
Instance details
Binary UnitId # 
Instance details
Binary ModuleName # 
Instance details
Binary Module # 
Instance details
Binary SrcSpan # 
Instance details
Binary InlineSpec # 
Instance details
Binary InlinePragma # 
Instance details
Binary RuleMatchInfo # 
Instance details
Binary Activation # 
Instance details
Binary SourceText # 
Instance details
Binary TupleSort # 
Instance details
Binary OverlapMode # 
Instance details
Binary OverlapFlag # 
Instance details
Binary RecFlag # 
Instance details
Binary FixityDirection # 
Instance details
Binary Fixity # 
Instance details
Binary WarningTxt # 
Instance details
Binary StringLiteral # 
Instance details
Binary FunctionOrData # 
Instance details
Binary LeftOrRight # 
Instance details
Binary DefUnitId # 
Instance details
Binary IndefUnitId # 
Instance details
Binary CType # 
Instance details
Binary Header # 
Instance details
Binary CCallConv # 
Instance details
Binary CCallTarget # 
Instance details
Binary CCallSpec # 
Instance details
Binary CExportSpec # 
Instance details
Binary Safety # 
Instance details
Binary ForeignCall # 
Instance details
Binary HscSource # 
Instance details
Binary NameSpace # 
Instance details
Binary AvailInfo # 
Instance details
Binary ArgFlag # 
Instance details
Binary IfaceCoercion # 
Instance details
Binary IfaceTyLit # 
Instance details
Binary IfaceTyCon # 
Instance details
Binary IfaceType # 
Instance details
Binary IfaceTcArgs # 
Instance details
Binary IsCafCC # 
Instance details
Binary CostCentre # 
Instance details
Binary Role # 
Instance details
Binary Injectivity # 
Instance details
Binary TyConBndrVis # 
Instance details
Binary IfaceUnivCoProv # 
Instance details
Binary IfaceTyConInfo # 
Instance details
Binary IfaceTyConSort # 
Instance details
Binary IsPromoted # 
Instance details
Binary IfaceOneShot # 
Instance details
Binary IfaceBndr # 
Instance details
Binary Literal # 
Instance details
Binary SrcUnpackedness # 
Instance details
Binary SrcStrictness # 
Instance details
Binary StrictSig # 
Instance details
Binary DmdType # 
Instance details
Binary CPRResult # 
Instance details
Binary DmdResult # 
Instance details
Binary Count # 
Instance details
Binary UseDmd # 
Instance details
Binary StrDmd # 
Instance details
Binary IsOrphan # 
Instance details
Binary IfaceJoinInfo # 
Instance details
Binary IfaceLetBndr # 
Instance details
Binary IfaceBinding # 
Instance details
Binary IfaceConAlt # 
Instance details
Binary IfaceTickish # 
Instance details
Binary IfaceExpr # 
Instance details
Binary IfaceIdDetails # 
Instance details
Binary IfaceUnfolding # 
Instance details
Binary IfaceInfoItem # 
Instance details
Binary IfaceIdInfo # 
Instance details
Binary IfaceCompleteMatch # 
Instance details
Binary IfaceAnnotation # 
Instance details
Binary IfaceRule # 
Instance details
Binary IfaceFamInst # 
Instance details
Binary IfaceClsInst # 
Instance details
Binary IfaceSrcBang # 
Instance details
Binary IfaceBang # 
Instance details
Binary IfaceConDecl # 
Instance details
Binary IfaceConDecls # 
Instance details
Binary IfaceAxBranch # 
Instance details
Binary IfaceAT # 
Instance details
Binary IfaceClassOp # 
Instance details
Binary IfaceFamTyConFlav # 
Instance details
Binary IfaceTyConParent # 
Instance details
Binary IfaceDecl # 
Instance details
Binary IfaceTrustInfo # 
Instance details
Binary IfaceVectInfo # 
Instance details
Binary Usage # 
Instance details
Binary Dependencies # 
Instance details
Binary Warnings # 
Instance details
Binary ModIface # 
Instance details
Binary a => Binary [a] # 
Instance details

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

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

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) # 
Instance details
Binary a => Binary (BooleanFormula a) # 
Instance details
Binary a => Binary (FieldLbl a) # 
Instance details
Binary name => Binary (AnnTarget name) # 
Instance details

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

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

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

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

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 (TyVarBndr tv vis) # 
Instance details

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

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

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

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

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

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

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