serialise-0.2.2.0: A binary serialisation library for Haskell values.

Copyright(c) Duncan Coutts 2015-2017
LicenseBSD3-style (see LICENSE.txt)
Maintainerduncan@community.haskell.org
Stabilityexperimental
Portabilitynon-portable (GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Codec.Serialise.IO

Contents

Description

High-level file-based API for serialising and deserialising values.

Synopsis

FilePath API

writeFileSerialise Source #

Arguments

:: Serialise a 
=> FilePath

The file to write to.

-> a

The value to be serialised and written.

-> IO () 

Serialise a ByteString and write it directly to the specified file.

Since: 0.2.0.0

readFileDeserialise Source #

Arguments

:: Serialise a 
=> FilePath

The file to read from.

-> IO a

The deserialised value.

Read the specified file (internally, by reading a ByteString) and attempt to decode it into a Haskell value using deserialise (the type of which is determined by the choice of the result type).

Throws: DeserialiseFailure if the file fails to deserialise properly.

Since: 0.2.0.0

Handle API

hPutSerialise Source #

Arguments

:: Serialise a 
=> Handle

The Handle to write to.

-> a

The value to be serialised and written.

-> IO () 

Serialise a ByteString (via serialise) and write it directly to the specified Handle.

Since: 0.2.0.0