[Haskell-cafe] ANNOUNCE: binary: high performance, pure binary serialisation

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Wed Jan 31 19:39:16 EST 2007


On Wed, 2007-01-31 at 14:38 +0300, Bulat Ziganshin wrote: 
> Hello Duncan,
> 
> Tuesday, January 30, 2007, 1:22:58 PM, you wrote:
> 
> > Can anyone see a real serialisation use case that needs a monad for the
> > serialisation side? I'd thought I had an example, but I was wrong.
> 
> my program, FreeArc, has its own compression level on top of
> serializing - i.e. data serialized sent in 64k blocks to the C
> compression routine and both serialization and compression are run at
> the same time using threads

That's an interesting suggestion! I think the way we'd tackle this is
not by integrating such a feature into the monoid/monad but instead do
it as a parallel evaluation strategy on the lazy bytestring.

I think it'd be something with type
 :: Lazy.ByteString -> Lazy.ByteString

and it'd work on the list structure of the lazy bytestring using
something like:
parBuffer 1 rwhnf :: [Strict.ByteString] -> [Strict.ByteString]

(from Control.Parallel.Strategies)

so you'd use it like so:

writeFile f . GZip.compress . parBuffer . Binary.serialise


Hmm, nice. Pure, lazy, compositional.

I wonder if it'll work...

Duncan



More information about the Haskell-Cafe mailing list