On Thu, 2009-02-12 at 19:55 -0500, Chung-chieh Shan wrote: > wren ng thornton <[email protected]> wrote in article > <[email protected]> in gmane.comp.lang.haskell.cafe: > > 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. > > FWIW, this idea is called defunctionalization (due to Reynolds), > and it works for higher-order functions as well (because you can > defunctionalize those function arguments in the same way). > > People in many fields put a lot of effort into turning their programs > into state machines... > This paper by Ezra Cooper and Phil Wadler is an interesting recent development in the theory of defunctionalization and very relevant to this particular topic as well: http://homepages.inf.ed.ac.uk/wadler/topics/links.html#located-lambda
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
