A fancier Get monad or two (a la binary and binary-strict)

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Jul 30 03:26:42 EDT 2008


On Wed, 2008-07-30 at 02:23 +0100, Chris Kuklewicz wrote:
> Summary: I have two new Get-like monads for binary data (byte-aligned) that also
>    (*) Suspend parsing and request more import when reading past the end of data.
>        It is possible to respond with Nothing to indicate the hard end of data.
>    (*) Return failures instead of calling error
>    (*) Offer lookAhead,lookAheadM,lookAheadE like Data.Binary.Get
>    (*) Are BinaryParser instances from Data.Binary.Strict.Class
>    (*) Are Monad Transformers (and thus MonadIO)
>    (*) Are MonadError,Plus,Reader,Writer,State and Applicative,Alternative
>    (*) They differ because one is also MonadCont while the other is simpler
>    (*) Simplified Non-transformer versions (applied to Identity) are defined

[..]

> I have tested the code, but it is still quite new.  I doubt I will have time to 
> make a proper cabal release. I may see if the maintainers of the binary-strict 
> or binary packages are interested in a fancier Get monad.

Yep, definitely interested. Sounds like we could make something that
would satisfy the needs of existing users of the binary and
binary-strict packages.

We'll have to look closely at the performance costs of the new features
but my intuition is that a non-transformer but continuation based
version that has error handling (and plus/alternative) and can request
more input should have minimal cost.

Duncan



More information about the Libraries mailing list