| Copyright | (c) Alexey Kuleshevich 2021 |
|---|---|
| License | BSD3 |
| Maintainer | Alexey Kuleshevich <alexey@kuleshevi.ch> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Massiv.Serialise
Description
This package provides instances for Serialise class for all mutable Array
representations in massiv package. These
instances are provided as orphans from a separate package in order to avoid direct
dependency on serialise package in
massiv.
Array serialisation is done by falling back onto instances for Vector types from
vector package.
Below is a simple example how to use it. Note a blank module import: import
Massiv.Serialise (), which is the only thing needed from this module in order to use
provided orphan instances.
>>>import Massiv.Serialise ()>>>import Data.Massiv.Array as A>>>let arr = A.fromList A.Seq [72,97,115,107,101,108,108] :: A.Vector A.P Int>>>serialise arr"\NUL\a\135\CANH\CANa\CANs\CANk\CANe\CANl\CANl">>>deserialise (serialise arr) :: A.Vector A.P IntArray P Seq (Sz1 7) [ 72, 97, 115, 107, 101, 108, 108 ]
Synopsis
- encodeIx :: forall ix. Index ix => ix -> Encoding
- decodeIx :: forall s ix. Index ix => Decoder s ix
- mkSzFail :: forall ix m. (Index ix, MonadFail m) => ix -> m (Sz ix)
- encodeArray :: forall v r ix e. (Manifest r e, Load r ix e, Mutable (ARepr v) e, Vector v e, VRepr (ARepr v) ~ v, Serialise (v e)) => Array r ix e -> Encoding
- decodeArray :: forall v r ix e s. (Typeable v, Vector v e, Load r ix e, Load (ARepr v) ix e, Mutable r e, Serialise (v e)) => Decoder s (Array r ix e)
Helper functions used to define Serialise instances
mkSzFail :: forall ix m. (Index ix, MonadFail m) => ix -> m (Sz ix) Source #
Construct size from index verifying its correctness.
Since: 0.1.0
encodeArray :: forall v r ix e. (Manifest r e, Load r ix e, Mutable (ARepr v) e, Vector v e, VRepr (ARepr v) ~ v, Serialise (v e)) => Array r ix e -> Encoding Source #
Encode array by using its corresponding vector instance
Since: 0.1.0
decodeArray :: forall v r ix e s. (Typeable v, Vector v e, Load r ix e, Load (ARepr v) ix e, Mutable r e, Serialise (v e)) => Decoder s (Array r ix e) Source #
Decode array by using its corresponding vector instance
Since: 0.1.0
Orphan instances
| Serialise Ix2 Source # | |
| Serialise Comp Source # | |
| Index (IxN n) => Serialise (IxN n) Source # | |
| Index ix => Serialise (Sz ix) Source # | |
| (Index ix, Serialise e) => Serialise (Array BL ix e) Source # | |
| (Index ix, Serialise e) => Serialise (Array B ix e) Source # | |
| (Index ix, NFData e, Serialise e) => Serialise (Array BN ix e) Source # | |
| (Index ix, Prim e, Serialise e) => Serialise (Array P ix e) Source # | |
| (Index ix, Storable e, Serialise e) => Serialise (Array S ix e) Source # | |
| (Index ix, Unbox e, Serialise e) => Serialise (Array U ix e) Source # | |