[Haskell-cafe] How to serialize thunks?

Krasimir Angelov kr.angelov at gmail.com
Thu Dec 21 03:00:04 EST 2006

Hi Joachim,

All those libraries really force the data because they all are written
in Haskell. If you want to serialize thunks then you will need some
support from RTS. This is something that is implemented in Clean but
this just uncovers a lot of other problems:

The serialization of thunk requires to store a reference to procedure
for thunk evaluation. After that it is tricky to do the deseriazation
because you will have to dynamically link the thunk evaluation code.
The program that do the serialization and the program that have to
read it aren't necessary one and the same program. In this case the
reading application should have some way to call code from the writing

Another problem arises when you have to recompile the writing
application. After the recompilation the evaluation code for some
thunk may not exist any more. The solution that Clean is using is to
keep a copy of each executable after each compilation.


On 12/21/06, Joachim Durchholz <jo at durchholz.org> wrote:
> I have skimmed the serialization libraries on haskell.org (NewBinary,
> SerTH, AltBinary, HsSyck, GenericSerialize).
> I'm under the impression that these all force the data that they serialize.
> Is that correct?
> If yes: are there workarounds? I'd really like to be able to use
> infinite data structures in the data that I serialize.
> Regards,
> Jo
> _______________________________________________
> 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