Personal tools

Binary IO

From HaskellWiki

Revision as of 23:25, 23 April 2010 by Avo (Talk | contribs)

Jump to: navigation, search

1 Data.Binary

There are a number of binary I/O libraries available for Haskell. The best to use is the new, semi-standard Data.Binary library:

   * Data.Binary

It's very simple to use, and provides a highly efficient, pure interface to binary serialisation.

A tutorial:

   * Serialisation_and_compression_with_Data_Binary

See also DealingWithBinaryData

2 Other libraries

For very simple serialisation, use
read
and
show
.

If you have simple binary IO requirements, then Data.ByteString might be easiest -- you get a List-like interface to packed byte arrays (interface documented here). For more complex serialisation, Data.Binary would be preferred.