Difference between revisions of "Binary IO"

From HaskellWiki
Jump to navigation Jump to search
m (Added link to DealingWithBinaryData)
m (link to serTH in internet archive)
Line 19: Line 19:
 
* JeremyShaw's update of HalDaume's NewBinary package (Cabalized): http://www.n-heptane.com/nhlab/repos/NewBinary
 
* JeremyShaw's update of HalDaume's NewBinary package (Cabalized): http://www.n-heptane.com/nhlab/repos/NewBinary
 
* [http://www.cse.unsw.edu.au/~dons/fps.html Data.ByteString] (Cabalised) also provides byte level operations, and is used in some applications for binary IO
 
* [http://www.cse.unsw.edu.au/~dons/fps.html Data.ByteString] (Cabalised) also provides byte level operations, and is used in some applications for binary IO
* [http://www.cs.helsinki.fi/u/ekarttun/SerTH/ SerTH], the TH version (sort of) of NewBinary.
+
* [http://www.cs.helsinki.fi/u/ekarttun/SerTH/ SerTH], [http://web.archive.org/web/20080123105519/http://www.cs.helsinki.fi/u/ekarttun/SerTH/ archived page] the TH version (sort of) of NewBinary.
 
* PeterSimons's BlockIO package (Cabalized): http://cryp.to/blockio/
 
* PeterSimons's BlockIO package (Cabalized): http://cryp.to/blockio/
 
* JohnGoerzen's MissingH package (Cabalized): http://quux.org/devel/missingh
 
* JohnGoerzen's MissingH package (Cabalized): http://quux.org/devel/missingh

Revision as of 23:25, 23 April 2010

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

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.