Hi Tim,
Am 06.04.2013 14:08, schrieb Tim Watson:
> Sadly we cannot guarantee that an instance of, say
> NFDATA will evaluate the data structure in the same way as the Binary
> instance, and since people can implement the instances themselves,
> the only way to guarantee that the strictness properties on the
> receiving end are precisely the same for both local and remote
> message passing is to also use the Binary instance in the local case,
> but throw away its ByteString result and pass the pointer instead.
>
You could also ask the user to confirm the equality of the evaluation.
That is, introduce a class to witness the equality of evaluation:
class (NFData a, Serializable a) => Sendable a where
And then have your sendFunction
(Sendable a) => optSend :: ...
In giving an instance for (Sendable b) the user confirms that evaluation
equality between serialize and rnf is (sufficiently) met for type b.
As it happens, today we Eden developers were discussing whether we could
implement your API using the Eden RTS as a student project. What we
would like to do, among other things, is use our existing RTS-level
serialization. However, we run into the same problem that we can not do
your evaluation without your serialization. So, if we follow that route,
we will probably switch from Serializable- to NFData-constraints. A
Sendable-constraint would be much more comfortable for us :-D
Thomas