Haskell函数能够被序列化吗? [英] Can Haskell functions be serialized?

查看:125
本文介绍了Haskell函数能够被序列化吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最好的方法是获得函数的表示(如果它可以以某种方式恢复)。出于效率原因,二进制序列化是首选。



我认为有一种方法可以在Clean中执行,因为不可能实现依赖于任务的iTask(所以函数)可以保存并在服务器再次运行时继续。



这对分布式haskell计算必不可少。



我不想在运行时解析haskell代码,如下所述:序列化在Haskell中的函数
我还需要序列化,而不仅仅是反序列化。

解决方案

不幸的是,对于当前的ghc运行时系统是不可能的。
函数和其他任意数据的序列化需要一些低级运行时支持,ghc实现者一直不愿添加。



序列化函数要求您可以序列化任何东西,因为任意数据(评估和未评估)可以是函数的一部分(例如,部分应用程序)。


The best way to do it would be to get the representation of the function (if it can be recovered somehow). Binary serialization is preferred for efficiency reasons.

I think there is a way to do it in Clean, because it would be impossible to implement iTask, which relies on that tasks (and so functions) can be saved and continued when the server is running again.

This must be important for distributed haskell computations.

I'm not looking for parsing haskell code at runtime as described here: Serialization of functions in Haskell. I also need to serialize not just deserialize.

解决方案

Unfortunately, it's not possible with the current ghc runtime system. Serialization of functions, and other arbitrary data, requires some low level runtime support that the ghc implementors have been reluctant to add.

Serializing functions requires that you can serialize anything, since arbitrary data (evaluated and unevaluated) can be part of a function (e.g., a partial application).

这篇关于Haskell函数能够被序列化吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆