The binary package

[Tags: bsd3, library]

Efficient, pure binary serialisation using lazy ByteStrings. Haskell values may be encoded to and from binary formats, written to disk as binary, or sent over the network. Serialisation speeds of over 1 G/sec have been observed, so this library should be suitable for high performance scenarios.


[Skip to ReadMe]

Properties

Versions0.2, 0.3, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.4.3.1, 0.4.4, 0.4.5, 0.5, 0.5.0.1, 0.5.0.2, 0.5.1.0, 0.5.1.1, 0.6.0.0, 0.6.1.0, 0.6.2.0, 0.6.3.0, 0.6.4.0, 0.7.0.0, 0.7.0.1, 0.7.1.0, 0.7.2.0, 0.7.2.1, 0.7.2.2, 0.7.2.3, 0.7.3.0, 0.7.4.0, 0.7.5.0, 0.7.6.0, 0.7.6.1
Change logNone available
Dependenciesarray, base (<2.2 || >=3 && <4.4), bytestring (>=0.9), containers [details]
LicenseBSD3
AuthorLennart Kolmodin <kolmodin@dtek.chalmers.se>
MaintainerLennart Kolmodin, Don Stewart <dons@galois.com>
Stabilityprovisional
CategoryData, Parsing
Home pagehttp://code.haskell.org/binary/
UploadedThu Aug 28 05:17:31 UTC 2008 by DonaldStewart
UpdatedSat Jan 10 12:46:34 UTC 2015 by HerbertValerioRiedel to revision 2
DistributionsDebian:0.7.2.1, Fedora:0.7.1.0, LTSHaskell:0.7.1.0, NixOS:0.7.5.0, Stackage:0.7.3.0
Downloads69078 total (1655 in last 30 days)
Votes
0 []
StatusDocs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Flags

NameDescriptionDefault
bytestring-in-baseEnabled
split-baseEnabled
applicative-in-baseEnabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for binary-0.4.3.1

  binary: efficient, pure binary serialisation using lazy ByteStrings
------------------------------------------------------------------------

The 'binary' package provides Data.Binary, containing the Binary class,
and associated methods, for serialising values to and from lazy
ByteStrings. 

A key feature of 'binary' is that the interface is both pure, and efficient.

The 'binary' package is portable to GHC and Hugs.

Building:

    runhaskell Setup.lhs configure
    runhaskell Setup.lhs build
    runhaskell Setup.lhs install

First:
    import Data.Binary

and then write an instance of Binary for the type you wish to serialise.
More information in the haddock documentation.

Deriving:

It is possible to mechanically derive new instances of Binary for your
types, if they support the Data and Typeable classes. A script is
provided in tools/derive. Here's an example of its use.

    $ cd binary 
    $ cd tools/derive 

    $ ghci -fglasgow-exts BinaryDerive.hs

    *BinaryDerive> :l Example.hs 

    *Main> deriveM (undefined :: Drinks)

    instance Binary Main.Drinks where
      put (Beer a) = putWord8 0 >> put a
      put Coffee = putWord8 1
      put Tea = putWord8 2
      put EnergyDrink = putWord8 3
      put Water = putWord8 4
      put Wine = putWord8 5
      put Whisky = putWord8 6
      get = do
        tag_ <- getWord8
        case tag_ of
          0 -> get >>= \a -> return (Beer a)
          1 -> return Coffee
          2 -> return Tea
          3 -> return EnergyDrink
          4 -> return Water
          5 -> return Wine
          6 -> return Whisky

Contributors:

    Lennart Kolmodin
    Duncan Coutts
    Don Stewart
    Spencer Janssen
    David Himmelstrup
    Björn Bringert
    Ross Paterson
    Einar Karttunen
    John Meacham
    Ulf Norell
    Tomasz Zielonka
    Stefan Karrmann
    Bryan O'Sullivan
    Florian Weimer