HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleserialise-0.2.6.1Haskell2010

Codec.Serialise

This module provides functions to serialise and deserialise Haskell values for storage or transmission, to and from lazy ByteStrings. It also provides a type class and utilities to help you make your types serialisable.

For a full tutorial on using this module, see Codec.Serialise.Tutorial.

Contents
  1. High level, one-shot API
  2. Deserialisation exceptions
  3. Incremental encoding interface
  4. The Serialise class
  5. IO operations
  6. FilePath API
  7. Handle API
Synopsis
  • Packageserialise-0.2.6.1
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceSerialise.hs

High level, one-shot API

The following API exposes a high level interface allowing you to quickly convert between arbitrary Haskell values (which are an instance of Serialise) and lazy ByteStrings.

valuedeserialise :: Serialise a => ByteString -> a

Deserialise a Haskell value from the external binary representation (which must have been made using serialise or related function).

Throws: DeserialiseFailure if the given external representation is invalid or does not correspond to a value of the expected type.

Deserialisation exceptions

An exception type that may be returned (by pure functions) or thrown (by IO actions) that fail to deserialise a given input.

Instances4Eq, Show, Exception, NFData

Incremental encoding interface

The following API allows you to encode or decode CBOR values incrementally, which is useful for large structures that require you to stream values in over time.

Deserialise a Haskell value from the external binary representation.

This allows input data to be provided incrementally, rather than all in one go. It also gives an explicit representation of deserialisation errors.

Note that the incremental behaviour is only for the input data, not the output value: the final deserialised value is constructed and returned as a whole, not incrementally.

datadata IDecode s a

An Incremental decoder, used to represent the result of attempting to run a decoder over a given input, and return a value of type a.

Constructors

The Serialise class

classclass Serialise a where

Types that are instances of the Serialise class allow values to be quickly encoded or decoded directly to a CBOR representation, for object transmission or storage.

Methods

Instances114Serialise, …

IO operations

Convenient utilities for basic IO operations.

FilePath API

Handle API