• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

benchmarks/H26-Aug-2021-2,8462,443

docker/H26-Aug-2021-199172

docs/hcar/H26-Aug-2021-4937

src/Data/H26-Aug-2021-3,3351,636

tests/H26-Aug-2021-1,186873

tools/derive/H26-Aug-2021-131112

.dockerignoreH A D19-Apr-202035 54

.gitignoreH A D19-Apr-2020175 1817

.travis.ymlH A D19-Apr-20202.1 KiB6453

GNUmakefileH A D26-Aug-202195 54

LICENSEH A D19-Apr-20201.4 KiB3124

README.mdH A D19-Apr-20202.8 KiB9467

Setup.lhsH A D19-Apr-202076 42

binary.cabalH A D25-May-20216.1 KiB213191

changelog.mdH A D26-Apr-20215.4 KiB197135

docker-compose.ymlH A D19-Apr-20201.7 KiB9182

ghc.mkH A D26-Aug-2021391 65

README.md

1# binary package #
2
3[![Hackage version](https://img.shields.io/hackage/v/binary.svg?label=Hackage)](https://hackage.haskell.org/package/binary) [![Stackage version](https://www.stackage.org/package/binary/badge/lts?label=Stackage)](https://www.stackage.org/package/binary) [![Build Status](https://api.travis-ci.org/kolmodin/binary.png?branch=master)](http://travis-ci.org/kolmodin/binary)
4
5*Efficient, pure binary serialisation using lazy ByteStrings.*
6
7The ``binary`` package provides Data.Binary, containing the Binary class,
8and associated methods, for serialising values to and from lazy
9ByteStrings.
10A key feature of ``binary`` is that the interface is both pure, and efficient.
11The ``binary`` package is portable to GHC and Hugs.
12
13## Installing binary from Hackage ##
14
15``binary`` is part of The Glasgow Haskell Compiler (GHC) and therefore if you
16have either GHC or [The Haskell Platform](http://www.haskell.org/platform/)
17installed, you already have ``binary``.
18
19More recent versions of ``binary`` than you might have installed may be
20available. You can use ``cabal-install`` to install a later version from
21[Hackage](http://hackage.haskell.org/package/binary).
22
23    $ cabal update
24    $ cabal install binary
25
26## Building binary ##
27
28``binary`` comes with both a test suite and a set of benchmarks.
29While developing, you probably want to enable both.
30Here's how to get the latest version of the repository, configure and build.
31
32    $ git clone git@github.com:kolmodin/binary.git
33    $ cd binary
34    $ cabal update
35    $ cabal configure --enable-tests --enable-benchmarks
36    $ cabal build
37
38Run the test suite.
39
40    $ cabal test
41
42## Using binary ##
43
44First:
45
46    import Data.Binary
47
48and then write an instance of Binary for the type you wish to serialise.
49An example doing exactly this can be found in the Data.Binary module.
50You can also use the Data.Binary.Builder module to efficiently build
51lazy bytestrings using the ``Builder`` monoid. Or, alternatively, the
52Data.Binary.Get and Data.Binary.Put to serialize/deserialize using
53the ``Get`` and ``Put`` monads.
54
55More information in the haddock documentation.
56
57## Deriving binary instances using GHC's Generic ##
58
59Beginning with GHC 7.2, it is possible to use binary serialization without
60writing any instance boilerplate code.
61
62```haskell
63{-# LANGUAGE DeriveGeneric #-}
64
65import Data.Binary
66import GHC.Generics (Generic)
67
68data Foo = Foo deriving (Generic)
69
70-- GHC will automatically fill out the instance
71instance Binary Foo
72```
73
74## Contributors ##
75
76* Lennart Kolmodin
77* Duncan Coutts
78* Don Stewart
79* Spencer Janssen
80* David Himmelstrup
81* Björn Bringert
82* Ross Paterson
83* Einar Karttunen
84* John Meacham
85* Ulf Norell
86* Tomasz Zielonka
87* Stefan Karrmann
88* Bryan O'Sullivan
89* Bas van Dijk
90* Florian Weimer
91
92For a full list of contributors, see
93[here](https://github.com/kolmodin/binary/graphs/contributors).
94