Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data BinaryParser a
- run :: BinaryParser a -> ByteString -> Either Text a
- failure :: Text -> BinaryParser a
- byte :: BinaryParser Word8
- bytesOfSize :: Int -> BinaryParser ByteString
- unitOfSize :: Int -> BinaryParser ()
- unitOfBytes :: ByteString -> BinaryParser ()
- remainders :: BinaryParser ByteString
- endOfInput :: BinaryParser ()
- sized :: Int -> BinaryParser a -> BinaryParser a
Documentation
data BinaryParser a Source
A highly-efficient parser specialised for strict ByteString
s.
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 Source
Apply a parser to bytes.
failure :: Text -> BinaryParser a Source
Fail with a message.
byte :: BinaryParser Word8 Source
Consume a single byte.
bytesOfSize :: Int -> BinaryParser ByteString Source
Consume an amount of bytes.
unitOfSize :: Int -> BinaryParser () Source
Skip an amount of bytes.
unitOfBytes :: ByteString -> BinaryParser () Source
Skip specific bytes, while failing if they don't match.
remainders :: BinaryParser ByteString Source
Consume all the remaining bytes.
endOfInput :: BinaryParser () Source
Fail if the input hasn't ended.
sized :: Int -> BinaryParser a -> BinaryParser a Source
Run a subparser passing it a chunk of the current input of the specified size.