[Haskell-cafe] Re: [Haskell] BitSyntax for Haskell

Einar Karttunen ekarttun at cs.helsinki.fi
Mon Sep 25 05:56:18 EDT 2006

On 23.09 15:00, Adam Langley wrote:
> Erlang's bit syntax[1] is a great for building and breaking up binary
> structures. I've knocked up something similar (although a little
> clumsy) for Haskell:
> http://www.imperialviolet.org/binary/bitsyntax/
> http://www.imperialviolet.org/binary/bitsyntax/BitSyntax.hs
> I'm sure that this isn't the best possible way to do this, but it
> suffices at this stage for many problems.

This looks very nice.

Here are some feature wishes:

BitBlock: add a way to encode length prefixed ByteStrings.

For the decoding part:
* Provide a monadic interface
* Add a test part to ReadType: 
    Test :: ReadType a -> (a -> Bool) -> ReadType Test
    (or a -> m ()) in the monadic case.
* Add a way to limit the size of a LengthPrefixed:
    e.g. [Unsigned 4, LengthPrefixed] is very unsafe, the app should
    have a way to control the maximum length.

- Einar Karttunen

More information about the Haskell-Cafe mailing list