Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility functions for serializing and deserializing samples.
Synopsis
- floatVecToByteString :: Vector v Float => v Float -> ByteString
- floatVecFromByteString :: Vector v Float => ByteString -> v Float
- doubleVecToByteString :: Vector v Double => v Double -> ByteString
- doubleVecFromByteString :: Vector v Double => ByteString -> v Double
- toByteString :: forall a. Storable a => Vector a -> ByteString
- fromByteString :: forall a. Storable a => ByteString -> Vector a
- toHandle :: Storable a => Handle -> Consumer (Vector a) IO ()
- fromHandle :: forall a. Storable a => Int -> Handle -> Producer (Vector a) IO ()
Slow Serialization/Deserialization
Slow functions for serializing/deserializing vectors to/from bytestrings using the Cereal library. There must be a better way to do this that doesn't involve copying.
Floats
floatVecToByteString :: Vector v Float => v Float -> ByteString Source #
Convert a Vector of Floats to a ByteString.
floatVecFromByteString :: Vector v Float => ByteString -> v Float Source #
Convert a ByteString to a Vector of Floats.
Doubles
doubleVecToByteString :: Vector v Double => v Double -> ByteString Source #
Convert a Vector of Doubles to a ByteString.
doubleVecFromByteString :: Vector v Double => ByteString -> v Double Source #
Convert a ByteString to a Vector of Doubles.
Fast Serialization/Deserialization
Fast functions for serializing/deserializing storable vectors to/from bytestrings.
toByteString :: forall a. Storable a => Vector a -> ByteString Source #
Convert a Vector of Storable values to a ByteString. This is fast as it is just a cast.
fromByteString :: forall a. Storable a => ByteString -> Vector a Source #
Convert a ByteString to a Vector of Storable values. This is fast as it is just a cast.
Pipes
Pipes that perform fast serialization/deserialization to a Handle.