Binary IO
From HaskellWiki
(Difference between revisions)
(style) |
(fixed dead links) |
||
| (3 intermediate revisions not shown.) | |||
| Line 1: | Line 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: | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | * [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary 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 == | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | ||
| - | + | * JeremyShaw's update of HalDaume's NewBinary package (Cabalized): http://www.n-heptane.com/nhlab/repos/NewBinary | |
| + | * [http://hackage.haskell.org/package/bytestring Data.ByteString] (Cabalised) also provides byte level operations, and is used in some applications for binary IO | ||
| + | * [http://web.archive.org/web/20080123105519/http://www.cs.helsinki.fi/u/ekarttun/SerTH/ SerTH], the TH version (sort of) of NewBinary. | ||
| + | * PeterSimons's BlockIO package (Cabalized): http://cryp.to/blockio/ | ||
| + | * JohnGoerzen's MissingH package (Cabalized): http://quux.org/devel/missingh | ||
| + | * SimonMarlow's experimental NewIO package: http://www.haskell.org/~simonmar/new-io.tar.gz (documentation at http://www.haskell.org/~simonmar/io/) | ||
| + | |||
| + | For very simple serialisation, use <hask>read</hask> and <hask>show</hask>. | ||
| - | + | 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 [http://www.cse.unsw.edu.au/~dons/fps/Data.FastPackedString.html here]). For more complex serialisation, Data.Binary would be preferred. | |
[[Category:Tutorials]] | [[Category:Tutorials]] | ||
Current revision
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
- JeremyShaw's update of HalDaume's NewBinary package (Cabalized): http://www.n-heptane.com/nhlab/repos/NewBinary
- Data.ByteString (Cabalised) also provides byte level operations, and is used in some applications for binary IO
- SerTH, the TH version (sort of) of NewBinary.
- PeterSimons's BlockIO package (Cabalized): http://cryp.to/blockio/
- JohnGoerzen's MissingH package (Cabalized): http://quux.org/devel/missingh
- SimonMarlow's experimental NewIO package: http://www.haskell.org/~simonmar/new-io.tar.gz (documentation at http://www.haskell.org/~simonmar/io/)
read
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.
