Binary: Put -> Builder
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
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
wrapper.
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?
http://hackage.haskell.org/packages/archive/binary/0.4.4/doc/html/src/Data-Binary.html#line-486
-- Char is serialised as UTF-8
instance Binary Char where
...
Duncan
More information about the Libraries
mailing list