planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellNone
LanguageHaskell2010

Serialise

Contents

Synopsis

Encoding

serialise :: Serialise a => a -> ByteString #

Serialise a Haskell value to an external binary representation.

The output is represented as a lazy ByteString and is constructed incrementally.

Since: serialise-0.2.0.0

serialiseIncremental :: Serialise a => a -> Builder #

Serialise a Haskell value to an external binary representation.

The output is represented as a Builder and is constructed incrementally. The representation as a Builder allows efficient concatenation with other data.

Since: serialise-0.2.0.0

Decoding

deserialiseOrFail :: Serialise a => ByteString -> Either DeserialiseFailure a #

Deserialise a Haskell value from the external binary representation, or get back a DeserialiseFailure.

Since: serialise-0.2.0.0

deserialiseIncremental :: Serialise a => ST s (IDecode s a) #

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.

Since: serialise-0.2.0.0

data DeserialiseFailure #

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

Since: cborg-0.2.0.0

type ByteOffset = Int64 #

Simple alias for Int64, used to make types more descriptive.

data 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

Partial (Maybe ByteString -> ST s (IDecode s a))

The decoder has consumed the available input and needs more to continue. Provide Just if more input is available and Nothing otherwise, and you will get a new IDecode.

Done !ByteString !ByteOffset a

The decoder has successfully finished. Except for the output value you also get any unused input as well as the number of bytes consumed.

Fail !ByteString !ByteOffset DeserialiseFailure

The decoder ran into an error. The decoder either used fail or was not provided enough input. Contains any unconsumed input, the number of bytes consumed, and a DeserialiseFailure exception describing the reason why the failure occurred.

Serialise class

class 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.

Since: serialise-0.2.0.0

Methods

encode :: a -> Encoding #

Definition for encoding a given type into a binary representation, using the Encoding Monoid.

Since: serialise-0.2.0.0

decode :: Decoder s a #

Definition of a given Decoder for a type.

Since: serialise-0.2.0.0

Instances
Serialise Bool

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Char

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Double

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Float

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Int

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Int8

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Int16

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Int32

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Int64

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Integer

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Natural

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Ordering

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Word

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Word8

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Word16

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Word32

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Word64

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise RuntimeRep

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise VecCount

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise VecElem

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise SomeTypeRep

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise ()

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: () -> Encoding #

decode :: Decoder s () #

encodeList :: [()] -> Encoding #

decodeList :: Decoder s [()] #

Serialise TyCon

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise KindRep

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise TypeLitSort

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise ByteString

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise ByteString

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Text

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise UTCTime

UTCTime is encoded using the extended time format which is currently in Internet Draft state, https://tools.ietf.org/html/draft-bormann-cbor-time-tag-00.

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Text

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Version

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise ExitCode

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise All

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Any

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CChar

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CSChar

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CUChar

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CShort

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CUShort

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CInt

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CUInt

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CLong

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CULong

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CLLong

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CULLong

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CFloat

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CDouble

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CPtrdiff

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CSize

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CWchar

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CSigAtomic

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CClock

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CTime

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CUSeconds

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CSUSeconds

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CIntPtr

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CUIntPtr

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CIntMax

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise CUIntMax

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Fingerprint

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise ShortByteString

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Term

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise IntSet

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise Half

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise [a]

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: [a] -> Encoding #

decode :: Decoder s [a] #

encodeList :: [[a]] -> Encoding #

decodeList :: Decoder s [[a]] #

Serialise a => Serialise (Maybe a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(Serialise a, Integral a) => Serialise (Ratio a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Complex a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise (Fixed e)

Values are serialised in units of least precision represented as Integer.

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Min a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Min a -> Encoding #

decode :: Decoder s (Min a) #

encodeList :: [Min a] -> Encoding #

decodeList :: Decoder s [Min a] #

Serialise a => Serialise (Max a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Max a -> Encoding #

decode :: Decoder s (Max a) #

encodeList :: [Max a] -> Encoding #

decodeList :: Decoder s [Max a] #

Serialise a => Serialise (First a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Last a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Last a -> Encoding #

decode :: Decoder s (Last a) #

encodeList :: [Last a] -> Encoding #

decodeList :: Decoder s [Last a] #

Serialise a => Serialise (WrappedMonoid a) 
Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Option a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (ZipList a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Identity a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (First a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Last a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Last a -> Encoding #

decode :: Decoder s (Last a) #

encodeList :: [Last a] -> Encoding #

decodeList :: Decoder s [Last a] #

Serialise a => Serialise (Dual a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Dual a -> Encoding #

decode :: Decoder s (Dual a) #

encodeList :: [Dual a] -> Encoding #

decodeList :: Decoder s [Dual a] #

Serialise a => Serialise (Sum a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Sum a -> Encoding #

decode :: Decoder s (Sum a) #

encodeList :: [Sum a] -> Encoding #

decodeList :: Decoder s [Sum a] #

Serialise a => Serialise (Product a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Down a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Down a -> Encoding #

decode :: Decoder s (Down a) #

encodeList :: [Down a] -> Encoding #

decodeList :: Decoder s [Down a] #

Serialise a => Serialise (NonEmpty a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (IntMap a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Tree a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Tree a -> Encoding #

decode :: Decoder s (Tree a) #

encodeList :: [Tree a] -> Encoding #

decodeList :: Decoder s [Tree a] #

Serialise a => Serialise (Seq a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Seq a -> Encoding #

decode :: Decoder s (Seq a) #

encodeList :: [Seq a] -> Encoding #

decodeList :: Decoder s [Seq a] #

(Ord a, Serialise a) => Serialise (Set a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Set a -> Encoding #

decode :: Decoder s (Set a) #

encodeList :: [Set a] -> Encoding #

decodeList :: Decoder s [Set a] #

(Serialise a, Prim a) => Serialise (Vector a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(Serialise a, Storable a) => Serialise (Vector a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(Serialise a, Unbox a) => Serialise (Vector a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(Serialise a, Hashable a, Eq a) => Serialise (HashSet a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Serialise a => Serialise (Vector a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(Serialise a, Serialise b) => Serialise (Either a b)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Either a b -> Encoding #

decode :: Decoder s (Either a b) #

encodeList :: [Either a b] -> Encoding #

decodeList :: Decoder s [Either a b] #

Typeable a => Serialise (TypeRep a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(Serialise a, Serialise b) => Serialise (a, b)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b) -> Encoding #

decode :: Decoder s (a, b) #

encodeList :: [(a, b)] -> Encoding #

decodeList :: Decoder s [(a, b)] #

(Serialise k, Hashable k, Eq k, Serialise v) => Serialise (HashMap k v)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: HashMap k v -> Encoding #

decode :: Decoder s (HashMap k v) #

encodeList :: [HashMap k v] -> Encoding #

decodeList :: Decoder s [HashMap k v] #

(Ord k, Serialise k, Serialise v) => Serialise (Map k v)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Map k v -> Encoding #

decode :: Decoder s (Map k v) #

encodeList :: [Map k v] -> Encoding #

decodeList :: Decoder s [Map k v] #

Serialise (Proxy a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(Serialise a, Serialise b, Serialise c) => Serialise (a, b, c)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b, c) -> Encoding #

decode :: Decoder s (a, b, c) #

encodeList :: [(a, b, c)] -> Encoding #

decodeList :: Decoder s [(a, b, c)] #

Serialise a => Serialise (Const a b)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Const a b -> Encoding #

decode :: Decoder s (Const a b) #

encodeList :: [Const a b] -> Encoding #

decodeList :: Decoder s [Const a b] #

Serialise (f a) => Serialise (Alt f a)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: Alt f a -> Encoding #

decode :: Decoder s (Alt f a) #

encodeList :: [Alt f a] -> Encoding #

decodeList :: Decoder s [Alt f a] #

(Serialise a, Serialise b, Serialise c, Serialise d) => Serialise (a, b, c, d)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b, c, d) -> Encoding #

decode :: Decoder s (a, b, c, d) #

encodeList :: [(a, b, c, d)] -> Encoding #

decodeList :: Decoder s [(a, b, c, d)] #

(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e) => Serialise (a, b, c, d, e)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b, c, d, e) -> Encoding #

decode :: Decoder s (a, b, c, d, e) #

encodeList :: [(a, b, c, d, e)] -> Encoding #

decodeList :: Decoder s [(a, b, c, d, e)] #

(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e, Serialise f) => Serialise (a, b, c, d, e, f)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b, c, d, e, f) -> Encoding #

decode :: Decoder s (a, b, c, d, e, f) #

encodeList :: [(a, b, c, d, e, f)] -> Encoding #

decodeList :: Decoder s [(a, b, c, d, e, f)] #

(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e, Serialise f, Serialise g) => Serialise (a, b, c, d, e, f, g)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b, c, d, e, f, g) -> Encoding #

decode :: Decoder s (a, b, c, d, e, f, g) #

encodeList :: [(a, b, c, d, e, f, g)] -> Encoding #

decodeList :: Decoder s [(a, b, c, d, e, f, g)] #

(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e, Serialise f, Serialise g, Serialise h) => Serialise (a, b, c, d, e, f, g, h)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b, c, d, e, f, g, h) -> Encoding #

decode :: Decoder s (a, b, c, d, e, f, g, h) #

encodeList :: [(a, b, c, d, e, f, g, h)] -> Encoding #

decodeList :: Decoder s [(a, b, c, d, e, f, g, h)] #

(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e, Serialise f, Serialise g, Serialise h, Serialise i) => Serialise (a, b, c, d, e, f, g, h, i)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

Methods

encode :: (a, b, c, d, e, f, g, h, i) -> Encoding #

decode :: Decoder s (a, b, c, d, e, f, g, h, i) #

encodeList :: [(a, b, c, d, e, f, g, h, i)] -> Encoding #

decodeList :: Decoder s [(a, b, c, d, e, f, g, h, i)] #