Personal tools

Binary IO

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(just use Data.Binary)
m (Added link to DealingWithBinaryData)
Line 12: Line 12:
   
 
* [[Serialisation_and_compression_with_Data_Binary]]
 
* [[Serialisation_and_compression_with_Data_Binary]]
  +
  +
See also [[DealingWithBinaryData]]
   
 
== Other libraries ==
 
== Other libraries ==

Revision as of 14:14, 27 May 2008

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.