Copyright | (c) Abhinav Gupta 2015 |
---|---|
License | BSD3 |
Maintainer | Abhinav Gupta <mail@abhinavg.net> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Implements a basic parser for binary data. The parser does not do any extra book-keeping besides keeping track of the current position in the ByteString.
Synopsis
- data Parser a
- runParser :: Parser a -> ByteString -> Either String a
- runParser' :: Parser a -> ByteString -> Either String (ByteString, a)
- int8 :: Parser Int8
- word8 :: Parser Word8
- int16 :: Parser Int16
- int32 :: Parser Int32
- int64 :: Parser Int64
- int64LE :: Parser Int64
- double :: Parser Double
- doubleLE :: Parser Double
- take :: Int -> Parser ByteString
Documentation
A simple ByteString parser.
runParser :: Parser a -> ByteString -> Either String a Source #
Run the parser on the given ByteString. Return either the failure message or the result.
runParser' :: Parser a -> ByteString -> Either String (ByteString, a) Source #
Run the parser on the given ByteString. Return either the failure message or the result and any left-over content.
int64LE :: Parser Int64 Source #
Produces a signed 64-bit integer (parsed in little endian byte ordering) and advances the parser.