Cristiano Paris wrote:
Manlio Perillo wrote:
> Cristiano Paris ha scritto:
> > I'm interested in the possibility of
> > stopping/pickling/unpickling/resuming a computation.
>
> Not sure this is a good thing in a web application.
I'm thinking of complex workflows and inversion of control.
A computation may stop, return a response, wait for a new request to
be passed by the HTTP server and return back a new response, stopping
again. This goes on forever. All this can be achieved in Haskell but
the serialization path, which is crucial for swapping out idle
sessions (containing the stopped computation) or to get back to life
after server stopped (for maintenance for instance). I guess this
should be doable in Clean, which has mechanisms to do dynamic binding
and serialization of closures.
It's ugly, but one option is to just reify your continuations as an ADT,
where there are constructors for each function and fields for each
variable that needs closing over. Serializing that ADT should be simple
(unless some of those functions are higher-order in which case you run
into the same problem of how to serialize the function arguments). In
GHC's STG machine this representation shouldn't have much overhead,
though it does require the developer to do the compiler's job.
--
Live well,
~wren
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe