HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleserialise-0.2.6.1Haskell2010

Codec.Serialise.Decoding

High level API for decoding values that were encoded with the Codec.Serialise.Encoding module, using a Monad based interface.

  • 3 types
  • 40 values
  • Packageserialise-0.2.6.1
  • Exports43
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceDecoding.hs

Decode primitive operations

3 declarations
newtypenewtype Decoder s a
#

A continuation-based decoder, used for decoding values that were previously encoded using the Codec.CBOR.Encoding module. As Decoder has a Monad instance, you can easily write Decoders monadically for building your deserialisation logic.

Instances4Monad, Functor, MonadFail, Applicative
datadata DecodeAction s a
#

An action, representing a step for a decoder to taken and a continuation to invoke with the expected value.

Constructors

Read input tokens

Decode a string of bytes as a ByteArray.

Also note that this will eagerly copy the content out of the input to ensure that the input does not leak in the event that the ByteArray is live but not forced.

Decode a textual string as UTF-8 encoded ByteArray. Note that the result is not validated to be well-formed UTF-8.

Also note that this will eagerly copy the content out of the input to ensure that the input does not leak in the event that the ByteArray is live but not forced.

Specialised Read input token operations

valuedecodeWordOf
  1. :: Word

    Expected value of the decoded word

  2. -> Decoder s ()
#

Attempt to decode a word with decodeWord, and ensure the word is exactly as expected, or fail.

Branching operations

Attempt to decode a token for the length of a finite, known list, or an indefinite list. If Nothing is returned, then an indefinite length list occurs afterwords. If Just x is returned, then a list of length x is encoded.

Attempt to decode a token for the length of a finite, known map, or an indefinite map. If Nothing is returned, then an indefinite length map occurs afterwords. If Just x is returned, then a map of length x is encoded.

Inspecting the token type

valuepeekAvailable :: Decoder s Int
#

Peek and return the length of the current buffer that we're running our decoder on.

datadata TokenType
#
Instances5Bounded, Enum, Eq, Ord, Show

Special operations

Sequence operations

2 declarations