Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- type Bits = [Bool]
- bit :: (Applicative n, InputParsing m, ParserInput m ~ Bits) => Format m n Bits Bool
- bigEndianBitsOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m ByteString) n ByteString a -> Format (m Bits) n Bits a
- bigEndianBytesOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m Bits) n Bits a -> Format (m ByteString) n ByteString a
- littleEndianBitsOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m ByteString) n ByteString a -> Format (m Bits) n Bits a
- littleEndianBytesOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m Bits) n Bits a -> Format (m ByteString) n ByteString a
Documentation
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
bigEndianBitsOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m ByteString) n ByteString a -> Format (m Bits) n Bits a Source #
bigEndianBytesOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m Bits) n Bits a -> Format (m ByteString) n ByteString a Source #
littleEndianBitsOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m ByteString) n ByteString a -> Format (m Bits) n Bits a Source #
littleEndianBytesOf :: (InputParsing (m Bits), InputParsing (m ByteString), InputMappableParsing m, Functor n, ParserInput (m Bits) ~ Bits, ParserInput (m ByteString) ~ ByteString) => Format (m Bits) n Bits a -> Format (m ByteString) n ByteString a Source #