Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module contains a single class which abstracts over Get and IncrementalGet, so that one can write parsers which work in both. If you are using this module, you may find that -fno-monomorphism-restriction is very useful.
Synopsis
- class (Monad m, Alternative m) => BinaryParser m where
- skip :: Int -> m ()
- bytesRead :: m Int
- remaining :: m Int
- isEmpty :: m Bool
- spanOf :: (Word8 -> Bool) -> m ByteString
- spanOf1 :: (Word8 -> Bool) -> m ByteString
- string :: ByteString -> m ()
- word8 :: Word8 -> m ()
- oneOf :: (Word8 -> Bool) -> m Word8
- many :: m a -> m [a]
- many1 :: m a -> m [a]
- optional :: m a -> m (Maybe a)
- getWord8 :: m Word8
- getByteString :: Int -> m ByteString
- getWord16be :: m Word16
- getWord32be :: m Word32
- getWord64be :: m Word64
- getWord16le :: m Word16
- getWord32le :: m Word32
- getWord64le :: m Word64
- getWordhost :: m Word
- getWord16host :: m Word16
- getWord32host :: m Word32
- getWord64host :: m Word64
Documentation
class (Monad m, Alternative m) => BinaryParser m where Source #
This is the generic class for the set of binary parsers. This lets you write parser functions which are agnostic about the pattern of parsing in which they get used (incremental, strict, bitwise etc)
skip, bytesRead, remaining, isEmpty, spanOf, getWord8, getByteString, getWord16be, getWord32be, getWord64be, getWord16le, getWord32le, getWord64le, getWordhost, getWord16host, getWord32host, getWord64host
spanOf :: (Word8 -> Bool) -> m ByteString Source #
spanOf1 :: (Word8 -> Bool) -> m ByteString Source #
string :: ByteString -> m () Source #
word8 :: Word8 -> m () Source #
oneOf :: (Word8 -> Bool) -> m Word8 Source #
many1 :: m a -> m [a] Source #
optional :: m a -> m (Maybe a) Source #
getByteString :: Int -> m ByteString Source #
getWord16be :: m Word16 Source #
getWord32be :: m Word32 Source #
getWord64be :: m Word64 Source #
getWord16le :: m Word16 Source #
getWord32le :: m Word32 Source #
getWord64le :: m Word64 Source #
getWordhost :: m Word Source #
getWord16host :: m Word16 Source #
getWord32host :: m Word32 Source #
getWord64host :: m Word64 Source #