HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

  • Packageghc-9.10.3
  • Exports53
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceBinary.hs
newtypenewtype Bin (a :: k)
#
Instances5Bounded, Eq, Ord, Show, Binary
  • Bounded (Bin a)Defined in ghc-9.10.3 · GHC.Utils.Binary
  • Eq (Bin a)Defined in ghc-9.10.3 · GHC.Utils.Binary
  • Ord (Bin a)Defined in ghc-9.10.3 · GHC.Utils.Binary
  • Show (Bin a)Defined in ghc-9.10.3 · GHC.Utils.Binary
  • Binary (Bin a)Defined in ghc-9.10.3 · GHC.Utils.Binary
classclass Binary a where
#

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

Methods

Instances238Binary, …
valueforwardPut :: BinHandle -> (b -> IO a) -> IO b -> IO (a, b)
#

"forwardPut put_A put_B" outputs A after B but allows A to be read before B by using a forward reference

For writing instances

4 declarations

Variable length encodings

4 declarations

Fixed length encoding

1 declaration
newtypenewtype FixedLengthEncoding a
#

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

Instances7Eq, Ord, Show, Binary, …

Lazy Binary I/O

4 declarations
valuelazyPutMaybe :: Binary a => BinHandle -> Maybe a -> IO ()
#

Serialize the constructor strictly but lazily serialize a value inside a Just.

This way we can check for the presence of a value without deserializing the value itself.

User data

6 declarations
datadata UserData
#

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

String table ("dictionary")

7 declarations

Newtype wrappers

3 declarations