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.
- 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 whereSource
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)
spanOf :: (Word8 -> Bool) -> m ByteStringSource
spanOf1 :: (Word8 -> Bool) -> m ByteStringSource
string :: ByteString -> m ()Source
oneOf :: (Word8 -> Bool) -> m Word8Source
optional :: m a -> m (Maybe a)Source
getByteString :: Int -> m ByteStringSource
getWord16be :: m Word16Source
getWord32be :: m Word32Source
getWord64be :: m Word64Source
getWord16le :: m Word16Source
getWord32le :: m Word32Source
getWord64le :: m Word64Source
getWordhost :: m WordSource
getWord16host :: m Word16Source