The lazyIOExample uses lazy I/O to read the file from the disk, which is
not suitable in all applications, and certainly not if you need to read
from a socket which has higher likelihood to fail. To address these needs,
use the incremental input method like in incrementalExample.
For an example of how to read incrementally from a Handle,
see the implementation of decodeFileOrFail in Data.Binary.

Run a Get monad and return Left on failure and Right on
success. In both cases any unconsumed input and the number of bytes
consumed is returned. In the case of failure, a human-readable
error message is included as well.

The incremental interface gives you more control over how input is
provided during parsing. This lets you e.g. interleave parsing and
I/O.

The incremental interface consumes a strict ByteString at a time, each
being part of the total amount of input. If your decoder needs more input to
finish it will return a Partial with a continuation.
If there is no more input, provide it Nothing.

Fail will be returned if it runs into an error, together with a message,
the position and the remaining input.
If it succeeds it will return Done with the resulting value,
the position and the remaining input.

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.
Offset from bytesRead will be relative to the start of isolate, not the
absolute of the input.

Deprecated: Use runGetIncremental instead. This function will be removed.

DEPRECATED. Provides compatibility with previous versions of this library.
Run a Get monad and return a tuple with three values.
The first value is the result of the decoder. The second and third are the
unused input, and the number of consumed bytes.

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.