[Haskell-cafe] Re: persist and retrieve of IO type?
Svein Ove Aas
svein.ove at aas.no
Sat Apr 10 09:27:51 EDT 2010
On Sat, Apr 10, 2010 at 11:19 AM, Jon Fairbairn
<jon.fairbairn at cl.cam.ac.uk> wrote:
> It sounds more like he wants two functions something like
>
> save:: FilePath -> [IO ()] -> IO ()
> restore:: FilePath -> IO [IO ()]
>
> to which the answer would be no.
>
It's an insoluble problem in general - the parameters baked into the
thunk may be infinite, or at least too large to persist, and the
functions may not be around if you try to load the persisted data into
a different version of the executable - but it's an interesting
problem to attempt solving.
Given that GHC 6.12 has added some of the base functionality required
(i.e. dynamic linking), I was planning to take a bash at it
(persisting functions in general, not just IO actions) in the summer.
I don't know if that would help you, though. It's certainly not a good
idea in general, and at any rate there's a good chance I won't
succeed.
(Of course, thunks aren't /actually/ infinite, in memory. Part of the
project would be an attempt to persist the thunks, allowing lazy
evaluation after reading them back in. Naturally this would only work
with the exact same executable, but that's not necessarily a problem.)
--
Svein Ove Aas
More information about the Haskell-Cafe
mailing list