construct-0.1: Haskell version of the Construct library for easy specification of file formats

Safe HaskellNone
LanguageHaskell2010

Construct.Bits

Contents

Description

This module exports the primitives and combinators for constructing formats with sub- or cross-byte components. See test/MBR.hs for an example of its use.

>>> testParse (bigEndianBytesOf $ pair (count 5 bit) (count 3 bit)) (ByteString.pack [9])
Right [(([False,False,False,False,True],[False,False,True]),"")]
Synopsis

Documentation

type Bits = [Bool] Source #

The list of bits

bit :: (Applicative n, InputParsing m, ParserInput m ~ Bits) => Format m n Bits Bool Source #

The primitive format of a single bit

>>> testParse bit [True, False, False, True]
Right [(True,[False,False,True])]

The combinators for converting between Bits and ByteString input streams