[Haskell-cafe] Bit fiddling

Jeremy Shaw jeremy.shaw at linspireinc.com
Wed May 18 15:06:23 EDT 2005


There is also Hal Daume III's port of Binary from nhc98 which has some
bit-fiddling features:


Not sure if it is better than any of the other suggestions, but I
thought I would mention it just in case.

(note: the debian directory in there is unofficial for now, possibly
broken, and the source / binary package names it generates will be
changing soon. But the cabal stuff is reasonably up-to-date.)

Jeremy Shaw.

At Wed, 18 May 2005 12:05:02 +0400,
Bulat Ziganshin wrote:
> Hello Florian,
> Wednesday, May 18, 2005, 12:44:14 AM, you wrote:
> FW> I'm toying a bit with Haskell and wondering what's the best way to
> FW> implement bit fiddling.  Most of my applications involve serializing
> FW> and deserializing small blobs (IP packets, for instance), and after
> FW> browsing the GHC library documentation, I'm not sure which appraoch I
> FW> should use.  That's why I'd appreciate pointers to sample code.
> you can find Binary.hs in the GHC 6.4 sources (sources of compiler
> itself) and close to this ByteStream library on my page
> http://freearc.narod.ru
> with help of my library all you need to deserialize data is just:
> (sign::Word32, block_type::Int16, crc::Word64)  <-  ByteStream.readMemory buf bufsize
> there is no such easy serialization, i just don't need it because my
> program uses only low-level functions, but i can add for you
> something like:
> (buf,bufsize) <- ByteStream.writeMemory (sign, block_type, crc)
> -- 
> Best regards,
>  Bulat                            mailto:bulatz at HotPOP.com
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list