Safe Haskell | None |
---|---|
Language | Haskell2010 |
A custom parsing monad, optimized for speed.
Documentation
A monad for parsing an input buffer.
runParser :: Parser a -> ByteString -> Either String a Source #
Evaluates a parser on the given input.
If the parser does not consume all of the input, the rest of the
input is discarded and the parser still succeeds. Parsers may use
atEnd
to detect whether they are at the end of the input.
Values returned from actions in this monad will not hold onto the original ByteString, but rather make immutable copies of subsets of its bytes.
getWord32le :: Parser Word32 Source #
Parser a 4-byte word in little-endian order.
getBytes :: Int -> Parser ByteString Source #
Parse a sequence of zero or more bytes of the given length.
The new ByteString is an immutable copy of the bytes in the input
and will be managed separately on the Haskell heap from the original
input ByteString
.
Fails the parse if given a negative length.