Serializable closures for distributed programming.
Go to file
2017-08-12 23:47:32 +02:00
.circleci Add stack setup step. 2017-06-19 20:19:09 +02:00
src/Control/Distributed Add capDup combinator. Useful for stating Apply/Bind laws. 2017-08-12 23:47:32 +02:00
tests Tests: slight simplification of generators 2017-06-19 17:38:55 +02:00
.gitignore Create .gitignore 2017-06-16 12:36:12 -07:00
.travis.yml Turn on --pedantic. 2017-03-20 19:47:22 +01:00
distributed-closure.cabal Introduce static class hierarchy. 2017-06-19 21:49:07 +02:00
LICENSE Initial commit. 2015-05-25 13:40:58 +02:00
README.md more readme twiddles. 2016-09-25 17:55:20 +02:00
Setup.hs Make cabal check clean. 2015-05-25 20:42:30 +02:00
stack.yaml Update LTS. 2017-03-20 19:31:24 +01:00

distributed-closure

Build Status

Leverage the -XStaticPointers extension from GHC 7.10 onwards for distributed programming using lightweight serializable closures. This package implements a serializable closure abstraction on top of static pointers. Serializable closures can be shipped around a computer cluster. This is useful for implementing intuitive and modular distributed applications. See this blog post for a hands on introduction and this paper for the original motivation.

Example

In GHC 8 and above, remoting a computation on another node using this library goes along the lines of

data NodeId

-- Assume we're given a spaw primitive.
spawn :: NodeId -> Closure (IO ()) -> IO ()

-- A computation to remote on another node.
hello :: String -> IO ()
hello name = putStrLn ("Hello, " ++ name)

main = do
  name <- getLine
  spawn "someAddress" (static hello `cap` name)

distributed-closure does not implement sending/receiving/spawning closures - that's left for higher-level frameworks. Only closure creation, composition and (de)serialization.