Closed eschnett closed 5 years ago
Hi! Serializing haskell functions is outside of the scope of store
. A couple possibilities come to mind:
Cloud Haskell has some support for serializing thunks: http://hackage.haskell.org/package/distributed-process-0.7.4/docs/Control-Distributed-Process-Closure.html . I haven't heard of a whole lot of cloud haskell use in production, but certainly some interesting ideas.
If you can represent your functions as a syntax tree, just data, then naturally you can serialize that. For a nice strategy to reuse haskell syntax and provide multiple interpretations for your DSL, finally tagless style is a cool approach: http://okmij.org/ftp/tagless-final/index.html
Thanks for the pointers.
Welcome! I hope dereferencing them is fruitful
Yes, they are. I went down a rabbit hole and then emerged here: http://hackage.haskell.org/package/packman : "Any Haskell data structure apart from mutable data structures (MVars and TVars) can be serialised [...]".
Is it possible to serialize functions or lambda expressions in some way?
The best way I've found so far would be to define your own
Category
-like type, adding a constraint that all objects in that category can be serialized. This seems tedious. Is there a better way?