
On Jan 9, 2008 5:01 PM, David Roundy
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 etc. Anyone like that idea? AGL -- Adam Langley agl@imperialviolet.org http://www.imperialviolet.org 650-283-9641