- data Get a
- runCont :: Get a -> forall r. ByteString -> Success a r -> Decoder r
- data Decoder a
- runGetIncremental :: Get a -> Decoder a
- readN :: Int -> (ByteString -> a) -> Get a
- readNWith :: Int -> (Ptr a -> IO a) -> Get a
- bytesRead :: Get Int64
- isolate :: Int -> Get a -> Get a
- withInputChunks :: s -> Consume s -> ([ByteString] -> b) -> ([ByteString] -> Get b) -> Get b
- type Consume s = s -> ByteString -> Either s (ByteString, ByteString)
- failOnEOF :: [ByteString] -> Get a
- get :: Get ByteString
- put :: ByteString -> Get ()
- ensureN :: Int -> Get ()
- remaining :: Get Int64
- getBytes :: Int -> Get ByteString
- isEmpty :: Get Bool
- lookAhead :: Get a -> Get a
- lookAheadM :: Get (Maybe a) -> Get (Maybe a)
- lookAheadE :: Get (Either a b) -> Get (Either a b)
- label :: String -> Get a -> Get a
- getByteString :: Int -> Get ByteString
The Get type
|Monad Get Source|
|Functor Get Source|
|Applicative Get Source|
|Alternative Get Source|
|MonadPlus Get Source|
A decoder produced by running a
|Fail !ByteString String|
The decoder ran into an error. The decoder either used
|Partial (Maybe ByteString -> Decoder a)|
|Done !ByteString a|
The decoder has successfully finished. Except for the output value you also get the unused input.
|BytesRead !Int64 (Int64 -> Decoder a)|
The decoder needs to know the current position in the input. Given the number of bytes remaning in the decoder, the outer decoder runner needs to calculate the position and resume the decoding.
Return at least
n bytes, maybe more. If not enough data is available
the computation will escape with
readNWith n f where
f must be deterministic and not have side effects.
Isolate a decoder to operate with a fixed number of bytes, and fail if
fewer bytes were consumed, or more bytes were attempted to be consumed.
If the given decoder fails,
isolate will also fail.
bytesRead will be relative to the start of
isolate, not the
absolute of the input.
With input chunks
Ensure that there are at least
n bytes available. If not, the
computation will escape with
Deprecated: This will force all remaining input, don't use it.
DEPRECATED. Get the number of bytes of remaining input. Note that this is an expensive function to use as in order to calculate how much input remains, all input has to be read and kept in-memory. The decoder keeps the input as a strict bytestring, so you are likely better off by calculating the remaining input in another way.
Test whether all input has been consumed, i.e. there are no remaining undecoded bytes.
Run the given decoder, but without consuming its input. If the given decoder fails, then so will this function.
Label a decoder. If the decoder fails, the label will be appended on a new line to the error message string.