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

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Wed Jan 16 17:41:05 EST 2008

Adam Langley <agl <at> imperialviolet.org> writes:

> On Jan 10, 2008 10:45 AM, Don Stewart <dons <at> galois.com> wrote:
> > That's pretty much what we envisaged as the approach to take.
> > Monad transformers adding some bit-buffer state over Get/Put.
> For anyone who's still reading this thread...
> I've just uploaded[1] binary-strict 0.2.1 which includes
> Data.Binary.Strict.BitGet - a Get like monad which works by the bit.
> I'm afraid that Haddock 2 is choaking on {-# UNPACK #-}, so I don't
> have the HTML documentation to point to. (And I thought that Haddock 2
> was going to fix all those parsing issues :( - hopefully I'm just
> doing something stupid).
> [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-strict-0.2.1

Thanks for taking the time on this.

The old NewBinary had

NewBinary.Binary.getBits ::
  NewBinary.Binary.BinHandle -> Int -> IO GHC.Word.Word8

which allowed you to do things like

tlv_ bin =
   do tagValueVal <- getBits bin 5
      tagConstructionVal <- getBits bin 1
      tagTypeVal <- getBits bin 2

I'm sure I'm wrong but putting bits into [Bool] doesn't look very efficient. Of
course, NewBinary didn't address what happened for n >= 8. Some possibilities
are a) not allowing more than 8 b) returning [Word8] or c) (which I thought was
where we'd go) a ByteString with some sort of padding.


More information about the Haskell-Cafe mailing list