I think the problem with function serialization is that unlike languages which run over a virtual machine, bytecode generated by GHC is platform-specific (just as compilated C or C++) and therefore can run directly on top of the system, which is far faster but less portable.<br>
<br>It wouldn&#39;t make much sense if, when sending functions through network, the receiver had to have the exact same system as the sender.<br><br>Back to FRP, now. I was wondering, Ben, which FRP framework you were using. I&#39;m trying to get into the whole FRP stuff, but I don&#39;t know which one is better/simpler when you have almost no knowledge about the field.<br>
<br><br><div class="gmail_quote">2010/4/28 Chris Eidhof <span dir="ltr">&lt;<a href="mailto:chris@eidhof.nl">chris@eidhof.nl</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I agree. This would be an extremely useful feature, not only for game development, but also for web development. We often use continuations as a way to add state to the web, but this fails for two reasons: whenever the server restarts, or when we scale to multiple machines.<br>

<br>
However, I think it is not easy to do this: traversing the heap should be relatively simple, however: what if a function implementation changes?<br>
<br>
An interesting approach is taken by the Clean guys: they use dynamics, which can store a function, a type representation and the heap to disk. See also this old thread: <a href="http://www.mail-archive.com/haskell-cafe@haskell.org/msg34054.html" target="_blank">http://www.mail-archive.com/haskell-cafe@haskell.org/msg34054.html</a><br>

<font color="#888888"><br>
-chris<br>
</font><div><div></div><div class="h5"><br>
On 28 apr 2010, at 19:50, Peter Verswyvelen wrote:<br>
<br>
&gt; Interesting topic. I find it a bit annoying that Haskell doesn&#39;t<br>
&gt; provide support to save functions. I understand this is problematic,<br>
&gt; but it would be very nice if the Haskell runtime provided a way to<br>
&gt; serialize (part of) the heap, making sure that pointers to compiled<br>
&gt; functions get resolved correctly.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Wed, Apr 28, 2010 at 6:42 PM, Christopher Lane Hinson<br>
&gt; &lt;<a href="mailto:lane@downstairspeople.org">lane@downstairspeople.org</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Wed, 28 Apr 2010, Ben wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; I want to save the state of the system to disk, I want to be able to<br>
&gt;&gt;&gt; play the game, pick a point to stop, freeze it and turn off the<br>
&gt;&gt;&gt; computer, and then come back later and resume.  Why is that unwise?<br>
&gt;&gt;&gt; What are the alternatives?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; B<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On Tue, 27 Apr 2010, Ben wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; slightly off topic, but how does one handle pausing / saving /<br>
&gt;&gt;&gt;&gt;&gt; restarting in the FRP framework, especially the arrowized version?<br>
&gt;&gt;<br>
&gt;&gt; If we&#39;re about Arrow FRP, remember that the arrow typeclass includes a<br>
&gt;&gt; function, &#39;arr&#39;, that admits any function as a parameter, and these are in<br>
&gt;&gt; general impossible to serialize to disk. Since Arrow FRP ends up roughly in<br>
&gt;&gt; a form of: FRP a b c = a b (c, FRP a b c), an Arrow instance is actually the<br>
&gt;&gt; state of the system.  There are a few tactics that would get us around this<br>
&gt;&gt; limitation, but they are rather severe.   You could render &#39;arr&#39; useless in<br>
&gt;&gt; several ways, or you could save all the input to a system and replay it.<br>
&gt;&gt;<br>
&gt;&gt; But I would argue that even if you wanted to do this, &quot;saving an FRP system&quot;<br>
&gt;&gt; is, to me, like &quot;saving a system in the IO monad,&quot; (which, there are tactics<br>
&gt;&gt; that would let you do this, too).  It&#39;s probablematic in part because the<br>
&gt;&gt; FRP system probably has active hooks into the user interface, such as<br>
&gt;&gt; windows and other widgits that it owns, and possibly other devices (such as<br>
&gt;&gt; physical rocket engines).  Even if the FRP system is completely pure and can<br>
&gt;&gt; be referenced by a single pointer, it is easily and rightfully aware of<br>
&gt;&gt; specific details of the hardware it is embedded in.<br>
&gt;&gt;<br>
&gt;&gt; So it seems to me that what we actually want, to do complex simulations with<br>
&gt;&gt; persistance, is not an FRP system that interacts with the outside world, but<br>
&gt;&gt; a &quot;self-contained, self-interacting, differential equation hairball.&quot;  Such<br>
&gt;&gt; a system would be very cool, but I think that the numerical algorithms<br>
&gt;&gt; needed exceed what an FRP system should try to provide.<br>
&gt;&gt;<br>
&gt;&gt; Friendly,<br>
&gt;&gt; --Lane<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Haskell-Cafe mailing list<br>
&gt;&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt;&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
&gt;&gt;<br>
&gt; _______________________________________________<br>
&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>