Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- serialise :: Serialise a => a -> ByteString
- serialiseIncremental :: Serialise a => a -> Builder
- deserialiseOrFail :: Serialise a => ByteString -> Either DeserialiseFailure a
- deserialiseIncremental :: Serialise a => ST s (IDecode s a)
- data DeserialiseFailure = DeserialiseFailure ByteOffset String
- type ByteOffset = Int64
- data IDecode s a
- = Partial (Maybe ByteString -> ST s (IDecode s a))
- | Done !ByteString !ByteOffset a
- | Fail !ByteString !ByteOffset DeserialiseFailure
- class Serialise a where
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 #
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
Instances
Eq DeserialiseFailure | |
Defined in Codec.CBOR.Read (==) :: DeserialiseFailure -> DeserialiseFailure -> Bool # (/=) :: DeserialiseFailure -> DeserialiseFailure -> Bool # | |
Show DeserialiseFailure | |
Defined in Codec.CBOR.Read showsPrec :: Int -> DeserialiseFailure -> ShowS # show :: DeserialiseFailure -> String # showList :: [DeserialiseFailure] -> ShowS # | |
Exception DeserialiseFailure | |
Defined in Codec.CBOR.Read | |
NFData DeserialiseFailure | |
Defined in Codec.CBOR.Read rnf :: DeserialiseFailure -> () # |
type ByteOffset = Int64 #
Simple alias for
, used to make types more descriptive.Int64
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
.
Partial (Maybe ByteString -> ST s (IDecode s a)) | The decoder has consumed the available input and needs more
to continue. Provide |
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
|
Serialise class
Types that are instances of the
class allow values
to be quickly encoded or decoded directly to a CBOR representation,
for object transmission or storage.Serialise
Since: serialise-0.2.0.0
Definition for encoding a given type into a binary
representation, using the Encoding
.Monoid
Since: serialise-0.2.0.0
Definition of a given
for a type.Decoder
Since: serialise-0.2.0.0
Instances
Serialise Bool | Since: serialise-0.2.0.0 |
Serialise Char | Since: serialise-0.2.0.0 |
Serialise Double | Since: serialise-0.2.0.0 |
Serialise Float | Since: serialise-0.2.0.0 |
Serialise Int | Since: serialise-0.2.0.0 |
Serialise Int8 | Since: serialise-0.2.0.0 |
Serialise Int16 | Since: serialise-0.2.0.0 |
Serialise Int32 | Since: serialise-0.2.0.0 |
Serialise Int64 | Since: serialise-0.2.0.0 |
Serialise Integer | Since: serialise-0.2.0.0 |
Serialise Natural | Since: serialise-0.2.0.0 |
Serialise Ordering | Since: serialise-0.2.0.0 |
Serialise Word | Since: serialise-0.2.0.0 |
Serialise Word8 | Since: serialise-0.2.0.0 |
Serialise Word16 | Since: serialise-0.2.0.0 |
Serialise Word32 | Since: serialise-0.2.0.0 |
Serialise Word64 | Since: serialise-0.2.0.0 |
Serialise RuntimeRep | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: RuntimeRep -> Encoding # decode :: Decoder s RuntimeRep # encodeList :: [RuntimeRep] -> Encoding # decodeList :: Decoder s [RuntimeRep] # | |
Serialise VecCount | Since: serialise-0.2.0.0 |
Serialise VecElem | Since: serialise-0.2.0.0 |
Serialise SomeTypeRep | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: SomeTypeRep -> Encoding # decode :: Decoder s SomeTypeRep # encodeList :: [SomeTypeRep] -> Encoding # decodeList :: Decoder s [SomeTypeRep] # | |
Serialise () | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class | |
Serialise TyCon | Since: serialise-0.2.0.0 |
Serialise KindRep | Since: serialise-0.2.0.0 |
Serialise TypeLitSort | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: TypeLitSort -> Encoding # decode :: Decoder s TypeLitSort # encodeList :: [TypeLitSort] -> Encoding # decodeList :: Decoder s [TypeLitSort] # | |
Serialise ByteString | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: ByteString -> Encoding # decode :: Decoder s ByteString # encodeList :: [ByteString] -> Encoding # decodeList :: Decoder s [ByteString] # | |
Serialise ByteString | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: ByteString -> Encoding # decode :: Decoder s ByteString # encodeList :: [ByteString] -> Encoding # decodeList :: Decoder s [ByteString] # | |
Serialise Text | Since: serialise-0.2.0.0 |
Serialise UTCTime |
Since: serialise-0.2.0.0 |
Serialise Text | Since: serialise-0.2.0.0 |
Serialise Version | Since: serialise-0.2.0.0 |
Serialise ExitCode | Since: serialise-0.2.0.0 |
Serialise All | Since: serialise-0.2.0.0 |
Serialise Any | Since: serialise-0.2.0.0 |
Serialise CChar | Since: serialise-0.2.0.0 |
Serialise CSChar | Since: serialise-0.2.0.0 |
Serialise CUChar | Since: serialise-0.2.0.0 |
Serialise CShort | Since: serialise-0.2.0.0 |
Serialise CUShort | Since: serialise-0.2.0.0 |
Serialise CInt | Since: serialise-0.2.0.0 |
Serialise CUInt | Since: serialise-0.2.0.0 |
Serialise CLong | Since: serialise-0.2.0.0 |
Serialise CULong | Since: serialise-0.2.0.0 |
Serialise CLLong | Since: serialise-0.2.0.0 |
Serialise CULLong | Since: serialise-0.2.0.0 |
Serialise CFloat | Since: serialise-0.2.0.0 |
Serialise CDouble | Since: serialise-0.2.0.0 |
Serialise CPtrdiff | Since: serialise-0.2.0.0 |
Serialise CSize | Since: serialise-0.2.0.0 |
Serialise CWchar | Since: serialise-0.2.0.0 |
Serialise CSigAtomic | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: CSigAtomic -> Encoding # decode :: Decoder s CSigAtomic # encodeList :: [CSigAtomic] -> Encoding # decodeList :: Decoder s [CSigAtomic] # | |
Serialise CClock | Since: serialise-0.2.0.0 |
Serialise CTime | Since: serialise-0.2.0.0 |
Serialise CUSeconds | Since: serialise-0.2.0.0 |
Serialise CSUSeconds | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: CSUSeconds -> Encoding # decode :: Decoder s CSUSeconds # encodeList :: [CSUSeconds] -> Encoding # decodeList :: Decoder s [CSUSeconds] # | |
Serialise CIntPtr | Since: serialise-0.2.0.0 |
Serialise CUIntPtr | Since: serialise-0.2.0.0 |
Serialise CIntMax | Since: serialise-0.2.0.0 |
Serialise CUIntMax | Since: serialise-0.2.0.0 |
Serialise Fingerprint | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: Fingerprint -> Encoding # decode :: Decoder s Fingerprint # encodeList :: [Fingerprint] -> Encoding # decodeList :: Decoder s [Fingerprint] # | |
Serialise ShortByteString | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class encode :: ShortByteString -> Encoding # decode :: Decoder s ShortByteString # encodeList :: [ShortByteString] -> Encoding # decodeList :: Decoder s [ShortByteString] # | |
Serialise Term | Since: serialise-0.2.0.0 |
Serialise IntSet | Since: serialise-0.2.0.0 |
Serialise Half | Since: serialise-0.2.0.0 |
Serialise a => Serialise [a] | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class | |
Serialise a => Serialise (Maybe a) | Since: serialise-0.2.0.0 |
(Serialise a, Integral a) => Serialise (Ratio a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Complex a) | Since: serialise-0.2.0.0 |
Serialise (Fixed e) | Values are serialised in units of least precision represented as
Since: serialise-0.2.0.0 |
Serialise a => Serialise (Min a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Max a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (First a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Last a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (WrappedMonoid a) | |
Defined in Codec.Serialise.Class encode :: WrappedMonoid a -> Encoding # decode :: Decoder s (WrappedMonoid a) # encodeList :: [WrappedMonoid a] -> Encoding # decodeList :: Decoder s [WrappedMonoid a] # | |
Serialise a => Serialise (Option a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (ZipList a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Identity a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (First a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Last a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Dual a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Sum a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Product a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Down a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (NonEmpty a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (IntMap a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Tree a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Seq a) | Since: serialise-0.2.0.0 |
(Ord a, Serialise a) => Serialise (Set a) | Since: serialise-0.2.0.0 |
(Serialise a, Prim a) => Serialise (Vector a) | Since: serialise-0.2.0.0 |
(Serialise a, Storable a) => Serialise (Vector a) | Since: serialise-0.2.0.0 |
(Serialise a, Unbox a) => Serialise (Vector a) | Since: serialise-0.2.0.0 |
(Serialise a, Hashable a, Eq a) => Serialise (HashSet a) | Since: serialise-0.2.0.0 |
Serialise a => Serialise (Vector a) | Since: serialise-0.2.0.0 |
(Serialise a, Serialise b) => Serialise (Either a b) | Since: serialise-0.2.0.0 |
Typeable a => Serialise (TypeRep a) | Since: serialise-0.2.0.0 |
(Serialise a, Serialise b) => Serialise (a, b) | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class | |
(Serialise k, Hashable k, Eq k, Serialise v) => Serialise (HashMap k v) | Since: serialise-0.2.0.0 |
(Ord k, Serialise k, Serialise v) => Serialise (Map k v) | Since: serialise-0.2.0.0 |
Serialise (Proxy a) | Since: serialise-0.2.0.0 |
(Serialise a, Serialise b, Serialise c) => Serialise (a, b, c) | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class | |
Serialise a => Serialise (Const a b) | Since: serialise-0.2.0.0 |
Serialise (f a) => Serialise (Alt f a) | Since: serialise-0.2.0.0 |
(Serialise a, Serialise b, Serialise c, Serialise d) => Serialise (a, b, c, d) | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class | |
(Serialise a, Serialise b, Serialise c, Serialise d, Serialise e) => Serialise (a, b, c, d, e) | Since: serialise-0.2.0.0 |
Defined in Codec.Serialise.Class | |
(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 |
Defined in Codec.Serialise.Class | |
(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 |
Defined in Codec.Serialise.Class | |
(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 |
Defined in Codec.Serialise.Class | |
(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 |
Defined in Codec.Serialise.Class |