| Copyright | (c) Artur M. Brodzki 2018 |
|---|---|
| License | BSD3 |
| Maintainer | artur@brodzki.org |
| Stability | experimental |
| Portability | Windows/POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Multilinear.Generic.Sequential.Serialize
Contents
Description
Synopsis
- toBinary :: (Serialize a, Unbox a) => Tensor a -> ByteString
- toBinaryFile :: (Serialize a, Unbox a) => Tensor a -> String -> IO ()
- fromBinary :: (Serialize a, Unbox a) => ByteString -> Either String (Tensor a)
- fromBinaryFile :: (Serialize a, Unbox a) => String -> ExceptT String IO (Tensor a)
- toJSON :: (ToJSON a, Unbox a) => Tensor a -> ByteString
- toJSONFile :: (ToJSON a, Unbox a) => Tensor a -> String -> IO ()
- fromJSON :: (FromJSON a, Unbox a) => ByteString -> Maybe (Tensor a)
- fromJSONFile :: (FromJSON a, Unbox a) => String -> MaybeT IO (Tensor a)
- fromCSVFile :: (FromField a, Unbox a) => String -> Char -> String -> ExceptT String IO (Tensor a)
- toCSVFile :: (ToField a, Unbox a) => Tensor a -> String -> IO ()
Documentation
Arguments
| :: (Serialize a, Unbox 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, Unbox 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, Unbox a) | |
| => String | File path. |
| -> ExceptT String IO (Tensor a) | Deserialized tensor or an error message |
Read tensor from binary file
Arguments
| :: (ToJSON a, Unbox 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, Unbox a) | |
| => ByteString | ByteString to deserialize |
| -> Maybe (Tensor a) | Deserialized tensor or Nothing, if deserialization error occured. |
Deserialize tensor from JSON string
Arguments
| :: (FromJSON a, Unbox a) | |
| => String | File path. |
| -> MaybeT IO (Tensor a) | Deserialized tensor or Nothing, if error occured. |
Read tensor from JSON file
Arguments
| :: (FromField a, Unbox 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
Orphan instances
| (ToJSON a, Unbox a) => ToJSON (Tensor a) Source # | |
| (FromJSON a, Unbox a) => FromJSON (Tensor a) Source # | |
| (FromField a, Unbox a) => FromRecord (Tensor a) Source # | |
Methods parseRecord :: Record -> Parser (Tensor a) # | |
| (ToField a, Unbox a) => ToRecord (Tensor a) Source # | |
| (Serialize a, Unbox a) => Serialize (Tensor a) Source # | |