binary-parser-0.5.2: A highly-efficient but limited parser API specialised for bytestrings

Safe HaskellNone
LanguageHaskell2010

BinaryParser

Synopsis

Documentation

data BinaryParser a #

A highly-efficient parser specialised for strict ByteStrings.

Supports the roll-back and alternative branching on the basis of the Alternative interface.

Does not generate fancy error-messages, which contributes to its efficiency.

run :: BinaryParser a -> ByteString -> Either Text a #

Apply a parser to bytes.

failure :: Text -> BinaryParser a #

Fail with a message.

byte :: BinaryParser Word8 #

Consume a single byte.

bytesOfSize :: Int -> BinaryParser ByteString #

Consume an amount of bytes.

unitOfSize :: Int -> BinaryParser () #

Skip an amount of bytes.

unitOfBytes :: ByteString -> BinaryParser () #

Skip specific bytes, while failing if they don't match.

remainders :: BinaryParser ByteString #

Consume all the remaining bytes.

endOfInput :: BinaryParser () #

Fail if the input hasn't ended.

sized :: Int -> BinaryParser a -> BinaryParser a #

Run a subparser passing it a chunk of the current input of the specified size.