[Haskell-cafe] Serialization of (a -> b) and IO a

Thomas Davie tom.davie at gmail.com
Thu Nov 11 04:25:46 EST 2010


On 11 Nov 2010, at 08:36, Luke Palmer wrote:

> On Thu, Nov 11, 2010 at 12:53 AM, Jesse Schalken
> <jesseschalken at gmail.com> wrote:
>> I have had a look at hs-plugins, but it is unclear how to derive a simple
>> pair of functions `(a -> b) -> ByteString` and `ByteString -> Either
>> ParseError (a -> b)`, for example, from the functionality it provides, if it
>> is possible at all. I guess such a thing requires thorough digging into the
>> depths of GHC, (or maybe even LLVM if
>> an architecture independent representation is sought, but I don't know
>> enough to say.). Perhaps this is more a question for those interested and
>> knowledgable in Haskell compilation (and, to some extent, decompilation).
>> If not Haskell, are there any languages which provide a simple serialization
>> and deserialization of functions?
> 
> As far as I know, GHC has no support for this.  There are issues with
> the idea that will come out pretty fast, such as:
> 
>    (1) Those cannot be pure functions, because it differentiate
> denotationally equal functions.  So it would have to be at least (a ->
> b) -> IO ByteString.

I don't think I agree, I didn't see a rule f == g => serialise f == serialise g anywhere.

Bob


More information about the Haskell-Cafe mailing list