Haskell Cloud and Closures

I've built a little program to compute the plus function remotely by using Cloud Haskell: http://pastebin.com/RK4AcWFM but i faced an unfortunate complication, what i would like to do is to send a function to another host, no matter if the function is locally declared or at the top level. In seems to me that in cloud haskell library the function's closures can be computed only with top-level ones, is it possible to compute the closure at runtime of any function and to send it to another host? here's the code that i would like to compile: http://pastebin.com/7F4hs1Kk thank you all in advance! Fred

Fred Smith wrote:
I've built a little program to compute the plus function remotely by using Cloud Haskell: http://pastebin.com/RK4AcWFM
but i faced an unfortunate complication, what i would like to do is to send a function to another host, no matter if the function is locally declared or at the top level.
In seems to me that in cloud haskell library the function's closures can be computed only with top-level ones, is it possible to compute the closure at runtime of any function and to send it to another host?
I was at the Haskell Symposium where this paper was presented. This limitation is a known limitation and cannot currently be worked around other than my moving whatever is required to the top level. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/

I'm curious, what are the advantages of Cloud Haskell over pakages like rpc?
Why isn't Cloud Haskell on Hackage?
2011/10/1 Erik de Castro Lopo
Fred Smith wrote:
I've built a little program to compute the plus function remotely by using Cloud Haskell: http://pastebin.com/RK4AcWFM
but i faced an unfortunate complication, what i would like to do is to send a function to another host, no matter if the function is locally declared or at the top level.
In seems to me that in cloud haskell library the function's closures can be computed only with top-level ones, is it possible to compute the closure at runtime of any function and to send it to another host?
I was at the Haskell Symposium where this paper was presented. This limitation is a known limitation and cannot currently be worked around other than my moving whatever is required to the top level.
Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 1 Ott, 12:03, Erik de Castro Lopo
I was at the Haskell Symposium where this paper was presented. This limitation is a known limitation and cannot currently be worked around other than my moving whatever is required to the top level.
Erik --
do you know if there is another way either to compute the closure of a function or to serialize it in order to send the computation to another host?

On Sat, Oct 1, 2011 at 4:54 AM, Fred Smith
do you know if there is another way either to compute the closure of a function or to serialize it in order to send the computation to another host?
You'll need to capture the functions as serializable data while it is being constructed. I am not sure of a good way to do this, but I think tangible values [1] and the associated DeepArrow features developed by Conal Elliott might provide a decent basis. These are based around the notions of representing functions and how they work internally, and composing them dynamically. [1] http://www.haskell.org/haskellwiki/TV

On Sat, 2011-10-01 at 02:16 -0700, Fred Smith wrote:
In seems to me that in cloud haskell library the function's closures can be computed only with top-level ones, is it possible to compute the closure at runtime of any function and to send it to another host?
The current rule is a bit overly restrictive, true. But I just wanted to point out that there is a good reason for having *some* restriction in place. There are certain types that should *not* be sent to other processes or nodes. Take MVar, for example. It's not clear what it would mean to send an MVar over a channel to a different node. By extension, allowing you to send arbitrary functions not defined at the top level is also problematic, because such functions might close over references to MVars, making them essentially a vehicle for smuggling MVars to new nodes. And since the types of free variables don't occur in the types of terms, there is no straight-forward Haskell type signature that can express this limitation. So the compiler is obliged to specify some kind of sufficient restrictions to prevent you from sending functions that close over MVar or other node-specific types. For now, you'll have to move all of your functions to the top level. Hopefully, in the future, some relaxation of those rules can occur. -- Chris
participants (5)
-
Chris Smith
-
David Barbour
-
Erik de Castro Lopo
-
Fred Smith
-
Yves Parès