Binary: Put -> Builder

Duncan Coutts duncan.coutts at
Fri Jan 23 15:03:52 EST 2009

On Fri, 2009-01-23 at 15:34 +0100, Henning Thielemann wrote:
> Is there a way to get the underlying Builder of a 'put' of a Binary 
> instance?

The binary package exposes the Data.Binary.Builder module so you can use
the Builder monoid directly. There is no need to go via the Put

There is no way to get at the 'current' state of the underlying Builder
value. In principle, it could provide the normal writer monad access
functions. What is the use case? Is there anything you can do with
direct access you cannot do with Put operations? If you want to inspect
the data already written then I suggest you do not. It would involve
running the whole thing twice (because internally it's something like a
difference list).

> How does the Char instance of Binary serialize?

-- Char is serialised as UTF-8
instance Binary Char where


More information about the Libraries mailing list