-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Serialize instances for Data.Vector types.
--   
--   Serialize instances for Data.Vector types.
@package cereal-vector
@version 0.2.0.1


-- | <a>Data.Serialize</a> functions for <a>Data.Vector.Generic</a>
--   vectors. Orphan instances are provided for <a>Data.Vector</a>,
--   <a>Data.Vector.Unboxed</a>, <a>Data.Vector.Storable</a>, and
--   <a>Data.Vector.Primitive</a> vectors.
--   
--   The serialized format is an <a>Int64</a> representing the length of
--   the vector, followed by the <a>Data.Serialize</a>d contents of each
--   element.
--   
--   Note that the functions in <a>Data.Vector.Storable.UnsafeSerialize</a>
--   perform much better when serialization does not need to account for
--   host endianness and word size.
module Data.Vector.Serialize

-- | Read a <a>Vector</a>.
genericGetVector :: (Serialize a, Vector v a) => Get (v a)

-- | Write a <a>Vector</a>.
genericPutVector :: (Serialize a, Vector v a) => Putter (v a)

-- | Read a <a>Vector</a> using custom <a>Get</a> for the vector's
--   elements.
genericGetVectorWith :: Vector v a => Get a -> Get (v a)

-- | Write a <a>Vector</a> using custom <a>Putter</a> for the vector's
--   elements.
genericPutVectorWith :: Vector v a => Putter a -> Putter (v a)
instance (Data.Serialize.Serialize a, GHC.Internal.Foreign.Storable.Storable a) => Data.Serialize.Serialize (Data.Vector.Storable.Vector a)
instance (Data.Serialize.Serialize a, Data.Vector.Unboxed.Base.Unbox a) => Data.Serialize.Serialize (Data.Vector.Unboxed.Base.Vector a)
instance (Data.Serialize.Serialize a, Data.Primitive.Types.Prim a) => Data.Serialize.Serialize (Data.Vector.Primitive.Vector a)
instance Data.Serialize.Serialize a => Data.Serialize.Serialize (Data.Vector.Vector a)


-- | Efficient, but unsafe <a>Get</a> and <a>Putter</a> for
--   <a>Data.Vector.Storable</a> vectors. The serialized format is an
--   <a>Int64</a> representing the length of the <a>Vector</a>, followed by
--   the raw bytes. Therefore behavior may be unpredictable if serialized
--   data is transferred between machines with different word size or
--   endianness.
module Data.Vector.Storable.UnsafeSerialize

-- | Get a <a>Vector</a> in host order, endian form, and word width.
unsafeGetVector :: Storable a => Get (Vector a)

-- | Put a <a>Vector</a> in host order, endian form, and word width.
unsafePutVector :: Storable a => Putter (Vector a)
