[Haskell-cafe] ANN: A triple of new packages for talking to the outside world

Adam Langley agl at imperialviolet.org
Tue Jan 8 15:26:25 EST 2008

On Jan 7, 2008 11:17 AM, Bryan O'Sullivan <bos at serpentine.com> wrote:
> > It would seem that there would be three possible outcomes from an
> > incremental Get:
> >   - Failure: some bitstreams are just invalid and no amount of extra
> > data will ever fix that
> >   - Complete [Result]: the last chunk of data has been processed.
> > Maybe this should also include the remainder of the data?
> >   - Partial Cont [Result]: needs more data, but here's a (possibly
> > empty) list of results so far.
> Yes, that's more or less exactly what I had in mind.

Ok, see http://www.imperialviolet.org/IncrementalGet.hs

Hot off the keyboard and lacking documentation and comments ;)

There's a small test function at the bottom which demonstrates an
infinite parser which extracts 16-bit ints from whatever you feed it.

  1) Should Finished include the remainder of the ByteString (e.g.
that which wasn't used by that parser)
  2) I've no idea what I've done to the parse speed
  3) I removed all the lookahead functions because, if the look ahead
runs out of data it's not clean what should be done. We can request
more with a partial result, but if the user doesn't have any more data
to give there's no way, currently, to signal this and cause the
lookahead to backtrack. Also, if we let the lookahead request more
data via a Partial, then there's no way for the user to tell that
Partial apart from one which has "real" values.

But if this is useful to you, make any requests. I'll (hopefully) do
them, clean it up and push a new release of binary-strict.


Adam Langley                                      agl at imperialviolet.org
http://www.imperialviolet.org                       650-283-9641

More information about the Haskell-Cafe mailing list