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

Adam Langley agl at imperialviolet.org
Wed Jan 9 20:25:56 EST 2008

On Jan 9, 2008 5:01 PM, David Roundy <droundy at darcs.net> wrote:
> But I can't imagine an implementation in which this change wouldn't slow
> down getBytes for the normal case.  Perhaps the slowdown would be small,
> but it seems unwise to enforce that slowness at the API level, when we've
> already got a perfectly good API for fast binary IO.  Maybe there's some
> type hackery you could do to avoid a speed penalty, but that's a lot to add
> for a somewhat dubious benefit.

I believe that it would be an additional if statement in the fast path at least.

How about a BitGet monad which get be run in the Get monad?

> test :: Get ()
> test = do
>  runBitGet 2 (do
>    getBitField 2)

So the first argument to runBitGet is the number of bytes to parse for
bit fields and then functions in BitGet can extract bit-length ints

Anyone like that idea?


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

More information about the Haskell-Cafe mailing list