| Copyright | (c) Artur M. Brodzki 2018 |
|---|---|
| License | BSD3 |
| Maintainer | artur@brodzki.org |
| Stability | experimental |
| Portability | Windows/POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Multilinear.Generic.Serialize
Contents
Description
Synopsis
- toBinary :: Serialize a => Tensor a -> ByteString
- toBinaryFile :: Serialize a => Tensor a -> String -> IO ()
- fromBinary :: Serialize a => ByteString -> Either String (Tensor a)
- fromBinaryFile :: Serialize a => String -> ExceptT String IO (Tensor a)
- toJSON :: ToJSON a => Tensor a -> ByteString
- toJSONFile :: ToJSON a => Tensor a -> String -> IO ()
- fromJSON :: FromJSON a => ByteString -> Maybe (Tensor a)
- fromJSONFile :: FromJSON a => String -> MaybeT IO (Tensor a)
- fromCSVFile :: FromField a => String -> Char -> String -> ExceptT String IO (Tensor a)
- toCSVFile :: ToField a => Tensor a -> String -> IO ()
Documentation
Arguments
| :: Serialize a | |
| => Tensor a | Tensor to serialize |
| -> ByteString | Tensor serialized to lazy ByteString |
Serialize tensor to zlib compressed binary string
Write tensor to binary file. Uses compression with gzip
Arguments
| :: Serialize a | |
| => ByteString | ByteString to deserialize |
| -> Either String (Tensor a) | Deserialized tensor or an error message. |
Deserialize tensor from zlib compressed binary string
Arguments
| :: Serialize a | |
| => String | File path. |
| -> ExceptT String IO (Tensor a) | Deserialized tensor or an error message |
Read tensor from binary file
Arguments
| :: ToJSON a | |
| => Tensor a | Tensor to serialize. |
| -> ByteString | Tensor serialized to lazy ByteString. |
Serialize tensor to JSON string
Write tensor to JSON file
Arguments
| :: FromJSON a | |
| => ByteString | ByteString to deserialize |
| -> Maybe (Tensor a) | Deserialized tensor or Nothing, if deserialization error occured. |
Deserialize tensor from JSON string
Arguments
| :: FromJSON a | |
| => String | File path. |
| -> MaybeT IO (Tensor a) | Deserialized tensor or Nothing, if error occured. |
Read tensor from JSON file
Arguments
| :: FromField a | |
| => String | File path. |
| -> Char | CSV separator |
| -> String | Matrix indices names |
| -> ExceptT String IO (Tensor a) | Deserialized tensor or an error message |
Read tensor from CSV
Write tensor to CSV file