
On Sat, Apr 10, 2010 at 7:32 PM, Daryoush Mehrtash
Can you please explain this:
....the parameters baked into theĀ thunk may be infinite....
I'm a bit bushed today, I think.. I was thinking of thunks. A haskell value can be infinite, since it's lazily evaluated; however, at the machine level a thunk is just a function pointer plus a bunch of value (possibly meaning other thunk) references - eminently walkable, assuming the GHC developers don't decide to alter the format. So, there are two ways a function serializer could work, taking currying into account: - Store the function pointer (or, preferably, the matching symbol name), force all the values and write those out along with it. This has the advantage of being less likely to break on upgrades, but since the values may be infinite.. yeah. - Store the function pointer, and walk the value references, storing the entire tree of thunks/function pointers pointed to by the original function value, but don't force any values. This at least guarantees that the serialized form is finite. All things considered, I'll be shooting for option #2. -- Svein Ove Aas