Portability | type-families |
---|---|

Stability | experimental |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | None |

# Documentation

class (Integral (Unchecked m), Monad m, Applicative m) => MonadGet m whereSource

An `Integral`

number type used for unchecked skips and counting.

The underlying ByteString type used by this instance

Skip ahead `n`

bytes. Fails if fewer than `n`

bytes are available.

uncheckedSkip :: Unchecked m -> m ()Source

Skip ahead `n`

bytes. No error if there isn't enough bytes.

ensure :: Int -> m ByteStringSource

If at least `n`

bytes are available return at least that much of the current input.
Otherwise fail.

Run `ga`

, but return without consuming its input.
Fails if `ga`

fails.

uncheckedLookAhead :: Unchecked m -> m (Bytes m)Source

Get the next up to `n`

bytes as a lazy ByteString, without consuming them.

getBytes :: Int -> m ByteStringSource

Pull `n`

bytes from the input, as a strict ByteString.

remaining :: m (Unchecked m)Source

Get the number of remaining unparsed bytes. Useful for checking whether all input has been consumed. Note that this forces the rest of the input.

Test whether all input has been consumed, i.e. there are no remaining unparsed bytes.

Read a Word8 from the monad state

getByteString :: Int -> m ByteStringSource

An efficient `get`

method for strict ByteStrings. Fails if fewer
than `n`

bytes are left in the input.

getLazyByteString :: Int64 -> m ByteStringSource

An efficient `get`

method for lazy ByteStrings. Does not fail if fewer than
`n`

bytes are left in the input.

getWord16be :: m Word16Source

Read a `Word16`

in big endian format

getWord16le :: m Word16Source

Read a `Word16`

in little endian format

getWord16host :: m Word16Source

*O(1).* Read a 2 byte `Word16`

in native host order and host endianness.

getWord32be :: m Word32Source

Read a `Word32`

in big endian format

getWord32le :: m Word32Source

Read a `Word32`

in little endian format

getWord32host :: m Word32Source

*O(1).* Read a `Word32`

in native host order and host endianness.

getWord64be :: m Word64Source

Read a `Word64`

in big endian format

getWord64le :: m Word64Source

Read a `Word64`

in little endian format

getWord64host :: m Word64Source

*O(1).* Read a `Word64`

in native host order and host endianess.

getWordhost :: m WordSource

*O(1).* Read a single native machine word. The word is read in
host order, host endian form, for the machine you're on. On a 64 bit
machine the Word is an 8 byte value, on a 32 bit machine, 4 bytes.

MonadGet Get | |

MonadGet Get | |

MonadGet m => MonadGet (ReaderT e m) | |

MonadGet m => MonadGet (StateT s m) | |

MonadGet m => MonadGet (StateT s m) | |

(MonadGet m, Monoid w) => MonadGet (WriterT w m) | |

(MonadGet m, Monoid w) => MonadGet (WriterT w m) | |

(MonadGet m, Monoid w) => MonadGet (RWST r w s m) | |

(MonadGet m, Monoid w) => MonadGet (RWST r w s m) |