HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

newtypenewtype Bin (a :: k)
#
Instances5Bounded, Eq, Ord, Show, Binary
  • Bounded (Bin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Eq (Bin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Ord (Bin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Show (Bin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Binary (Bin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
datadata RelBin (a :: k)
#

Like a Bin but is used to store relative offset pointers. Relative offset pointers store a relative location, but also contain an anchor that allow to obtain the absolute offset.

Constructors

Instances4Bounded, Eq, Ord, Show
  • Bounded (RelBin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Eq (RelBin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Ord (RelBin a)Defined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Show (RelBin a)Defined in ghc-lib-parser-9.14.1.20251220 · 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

Instances250Binary, …
datadata ReadBinHandle
#

A read-only handle that can be used to deserialise binary data from a buffer.

The buffer is an unboxed binary array.

datadata WriteBinHandle
#

A write-only handle that can be used to serialise binary data into a buffer.

The buffer is an unboxed binary array.

Copy the BinBuffer to a new BinBuffer which is exactly the right size. This performs a copy of the underlying buffer. The buffer may be truncated if the offset is not at the end of the written output.

UserData is also discarded during the copy You should just use this when translating a Put handle into a Get handle.

valueforwardGet :: ReadBinHandle -> IO a -> IO a
#

Read a value stored using a forward reference

The forward reference is expected to be an absolute offset.

valueforwardPutRel :: WriteBinHandle -> (b -> IO a) -> IO b -> IO (a, b)
#

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

This forward reference is a relative offset that allows us to skip over the result of put_A.

valueforwardGetRel :: ReadBinHandle -> IO a -> IO a
#

Read a value stored using a forward reference.

The forward reference is expected to be a relative offset.

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

6 declarations
valuelazyPutMaybe :: Binary a => WriteBinHandle -> 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.

EnumBinary

1 declaration

User data

16 declarations
datadata ReaderUserData
#

UserData required to deserialise symbols for interface files.

See Note [Binary UserData]

datadata WriterUserData
#

UserData required to serialise symbols for interface files.

See Note [Binary UserData]

Binary Readers & Writers

8 declarations

Tables

2 declarations

String table ("dictionary")

8 declarations

Generic deduplication table

6 declarations
datadata GenericSymbolTable (m :: Type -> Type)
#

The GenericSymbolTable stores a mapping from already seen elements to an index. If an element wasn't seen before, it is added to the mapping together with a fresh index.

GenericSymbolTable is a variant of a BinSymbolTable that is polymorphic in the table implementation. As such it can be used with any container that implements the TrieMap type class.

While GenericSymbolTable is similar to the BinSymbolTable, it supports storing tree-like structures such as Type and IfaceType more efficiently.

Constructors

Newtype wrappers

3 declarations

Newtypes for types that have canonically more than one valid encoding

8 declarations
datadata FullBinData
#

FullBinData stores a slice to a BinArray.

It requires less memory than ReadBinHandle, and can be constructed from a ReadBinHandle via freezeBinHandle and turned back into a ReadBinHandle using thawBinHandle. Additionally, the byte array slice can be put into a WriteBinHandle without extra conversions via putFullBinData.

Constructors

Instances2Eq, Ord
  • Eq FullBinDataDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary
  • Ord FullBinDataDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Utils.Binary

FingerprintWithValue

1 declaration
datadata FingerprintWithValue a
#

A wrapper which allows us to store a fingerprint and optionally the value which was used to create the fingerprint.

Instances3Functor, NFData, Binary