tweag/distributed-process — pull request #2 by facundominguez (2014-03-11 18:41:24+00:00)
Title: Generalize d-p to work with any label provided by d-static.

This third draft works without using BuiltIn labels, but instead hardcoding the label type to be of the form (Either StringLabel l).

An issue that remains to be solved is how to expose to the user the BuiltIn combinators. Currently they are implemented for unions of labels. This was necessary to implement the combinators in C.D.P.Internal.Spawn. For instance:

splitCP :: (Typeable a, Typeable b, Typeable c, Typeable d)
=> CP a c -> CP b d -> CP (a, b) (c, d)

is rewritten to

splitCP :: (Typeable a, Typeable b, Typeable c, Typeable d)
=> CP (Label l) a c -> CP (Label l) b d -> CP (Label l) (a, b) (c, d)

type Label l = Either StringLabel l

But it is not possible to produce the original type signature by specializing the later.

A solution could be to have d-p define:

type Closure a = G.Closure (Label StringLabel) a
type CP a b = BuiltIn.CP (Label StringLabel) a b