serialise-0.2.6.0: A binary serialisation library for Haskell values.
Copyright(c) Duncan Coutts 2015-2017
LicenseBSD3-style (see LICENSE.txt)
Maintainerduncan@community.haskell.org
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Codec.Serialise.Decoding

Description

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

Synopsis

Decode primitive operations

data Decoder s a #

Instances

Instances details
MonadFail (Decoder s) 
Instance details

Defined in Codec.CBOR.Decoding

Methods

fail :: String -> Decoder s a #

Applicative (Decoder s) 
Instance details

Defined in Codec.CBOR.Decoding

Methods

pure :: a -> Decoder s a #

(<*>) :: Decoder s (a -> b) -> Decoder s a -> Decoder s b #

liftA2 :: (a -> b -> c) -> Decoder s a -> Decoder s b -> Decoder s c #

(*>) :: Decoder s a -> Decoder s b -> Decoder s b #

(<*) :: Decoder s a -> Decoder s b -> Decoder s a #

Functor (Decoder s) 
Instance details

Defined in Codec.CBOR.Decoding

Methods

fmap :: (a -> b) -> Decoder s a -> Decoder s b #

(<$) :: a -> Decoder s b -> Decoder s a #

Monad (Decoder s) 
Instance details

Defined in Codec.CBOR.Decoding

Methods

(>>=) :: Decoder s a -> (a -> Decoder s b) -> Decoder s b #

(>>) :: Decoder s a -> Decoder s b -> Decoder s b #

return :: a -> Decoder s a #

data DecodeAction s a #

Constructors

ConsumeWord (Word# -> ST s (DecodeAction s a)) 
ConsumeWord8 (Word# -> ST s (DecodeAction s a)) 
ConsumeWord16 (Word# -> ST s (DecodeAction s a)) 
ConsumeWord32 (Word# -> ST s (DecodeAction s a)) 
ConsumeNegWord (Word# -> ST s (DecodeAction s a)) 
ConsumeInt (Int# -> ST s (DecodeAction s a)) 
ConsumeInt8 (Int# -> ST s (DecodeAction s a)) 
ConsumeInt16 (Int# -> ST s (DecodeAction s a)) 
ConsumeInt32 (Int# -> ST s (DecodeAction s a)) 
ConsumeListLen (Int# -> ST s (DecodeAction s a)) 
ConsumeMapLen (Int# -> ST s (DecodeAction s a)) 
ConsumeTag (Word# -> ST s (DecodeAction s a)) 
ConsumeInteger (Integer -> ST s (DecodeAction s a)) 
ConsumeFloat (Float# -> ST s (DecodeAction s a)) 
ConsumeDouble (Double# -> ST s (DecodeAction s a)) 
ConsumeBytes (ByteString -> ST s (DecodeAction s a)) 
ConsumeByteArray (ByteArray -> ST s (DecodeAction s a)) 
ConsumeString (Text -> ST s (DecodeAction s a)) 
ConsumeUtf8ByteArray (ByteArray -> ST s (DecodeAction s a)) 
ConsumeBool (Bool -> ST s (DecodeAction s a)) 
ConsumeSimple (Word# -> ST s (DecodeAction s a)) 
ConsumeBytesIndef (ST s (DecodeAction s a)) 
ConsumeStringIndef (ST s (DecodeAction s a)) 
ConsumeListLenIndef (ST s (DecodeAction s a)) 
ConsumeMapLenIndef (ST s (DecodeAction s a)) 
ConsumeNull (ST s (DecodeAction s a)) 
ConsumeListLenOrIndef (Int# -> ST s (DecodeAction s a)) 
ConsumeMapLenOrIndef (Int# -> ST s (DecodeAction s a)) 
ConsumeBreakOr (Bool -> ST s (DecodeAction s a)) 
PeekTokenType (TokenType -> ST s (DecodeAction s a)) 
PeekAvailable (Int# -> ST s (DecodeAction s a)) 
PeekByteOffset (Int# -> ST s (DecodeAction s a)) 
ConsumeWordCanonical (Word# -> ST s (DecodeAction s a)) 
ConsumeWord8Canonical (Word# -> ST s (DecodeAction s a)) 
ConsumeWord16Canonical (Word# -> ST s (DecodeAction s a)) 
ConsumeWord32Canonical (Word# -> ST s (DecodeAction s a)) 
ConsumeNegWordCanonical (Word# -> ST s (DecodeAction s a)) 
ConsumeIntCanonical (Int# -> ST s (DecodeAction s a)) 
ConsumeInt8Canonical (Int# -> ST s (DecodeAction s a)) 
ConsumeInt16Canonical (Int# -> ST s (DecodeAction s a)) 
ConsumeInt32Canonical (Int# -> ST s (DecodeAction s a)) 
ConsumeListLenCanonical (Int# -> ST s (DecodeAction s a)) 
ConsumeMapLenCanonical (Int# -> ST s (DecodeAction s a)) 
ConsumeTagCanonical (Word# -> ST s (DecodeAction s a)) 
ConsumeIntegerCanonical (Integer -> ST s (DecodeAction s a)) 
ConsumeFloat16Canonical (Float# -> ST s (DecodeAction s a)) 
ConsumeFloatCanonical (Float# -> ST s (DecodeAction s a)) 
ConsumeDoubleCanonical (Double# -> ST s (DecodeAction s a)) 
ConsumeBytesCanonical (ByteString -> ST s (DecodeAction s a)) 
ConsumeByteArrayCanonical (ByteArray -> ST s (DecodeAction s a)) 
ConsumeStringCanonical (Text -> ST s (DecodeAction s a)) 
ConsumeUtf8ByteArrayCanonical (ByteArray -> ST s (DecodeAction s a)) 
ConsumeSimpleCanonical (Word# -> ST s (DecodeAction s a)) 
Fail String 
Done a 

Read input tokens

decodeByteArray :: Decoder s ByteArray #

Specialised Read input token operations

Branching operations

Inspecting the token type

data TokenType #

Special operations

Sequence operations

decodeSequenceLenIndef :: (r -> a -> r) -> r -> (r -> r') -> Decoder s a -> Decoder s r' #

decodeSequenceLenN :: (r -> a -> r) -> r -> (r -> r') -> Int -> Decoder s a -> Decoder s r' #