multilinear-io-0.4.0.0: Conduit-vased input/output capability for multilinear package.

Copyright(c) Artur M. Brodzki 2018
LicenseBSD3
Maintainerartur@brodzki.org
Stabilityexperimental
PortabilityWindows/POSIX
Safe HaskellNone
LanguageHaskell2010

Multilinear.Generic.Serialize

Contents

Description

 
Synopsis

Documentation

toBinary Source #

Arguments

:: (Serialize a, Unbox a) 
=> Tensor a

Tensor to serialize

-> ByteString

Tensor serialized to lazy ByteString

Serialize tensor to zlib compressed binary string

toBinaryFile Source #

Arguments

:: (Serialize a, Unbox a) 
=> Tensor a

Tensor to serialize

-> String

File name

-> IO () 

Write tensor to binary file. Uses compression with gzip

fromBinary Source #

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

fromBinaryFile Source #

Arguments

:: (Serialize a, Unbox a) 
=> String

File path.

-> ExceptT String IO (Tensor a)

Deserialized tensor or an error message

Read tensor from binary file

toJSON Source #

Arguments

:: (ToJSON a, Unbox a) 
=> Tensor a

Tensor to serialize.

-> ByteString

Tensor serialized to lazy ByteString.

Serialize tensor to JSON string

toJSONFile Source #

Arguments

:: (ToJSON a, Unbox a) 
=> Tensor a

Tensor to serialize

-> String

File path.

-> IO () 

Write tensor to JSON file

fromJSON Source #

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

fromJSONFile Source #

Arguments

:: (FromJSON a, Unbox a) 
=> String

File path.

-> MaybeT IO (Tensor a)

Deserialized tensor or Nothing, if error occured.

Read tensor from JSON file

fromCSVFile Source #

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

toCSVFile Source #

Arguments

:: (ToField a, Unbox a) 
=> Tensor a

Tensor to serialize

-> String

File path

-> IO () 

Write tensor to CSV file

Orphan instances

(ToJSON a, Unbox a) => ToJSON (Tensor a) Source # 
Instance details

(FromJSON a, Unbox a) => FromJSON (Tensor a) Source # 
Instance details

(FromField a, Unbox a) => FromRecord (Tensor a) Source # 
Instance details

Methods

parseRecord :: Record -> Parser (Tensor a) #

(ToField a, Unbox a) => ToRecord (Tensor a) Source # 
Instance details

Methods

toRecord :: Tensor a -> Record #

(Serialize a, Unbox a) => Serialize (Tensor a) Source # 
Instance details

Methods

put :: Putter (Tensor a) #

get :: Get (Tensor a) #