ghc-8.4.1: The GHC API

Safe HaskellNone
LanguageHaskell2010

Binary

Contents

Synopsis

Documentation

data Bin a Source #

Instances
Bounded (Bin a) Source # 
Instance details

Methods

minBound :: Bin a #

maxBound :: Bin a #

Eq (Bin a) Source # 
Instance details

Methods

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

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

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

Methods

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

show :: Bin a -> String #

showList :: [Bin a] -> ShowS #

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

Methods

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

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

get :: BinHandle -> IO Int Source #

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

Methods

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

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

get :: BinHandle -> IO () Source #

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

Methods

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

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

get :: BinHandle -> IO Day Source #

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