The distributed-closure package

[ Tags: bsd3, control, library ] [ Propose Tags ]


[Skip to Readme]


Versions,,,,,,,, 0.3.5, 0.4.0 (info)
Dependencies base (>=4.8 && <5), binary (>=0.7.5), bytestring (>=0.10), constraints (>=0.4), syb (>=0.5), template-haskell (>=2.10) [details]
License BSD3
Copyright © Tweag I/O Limited
Author Mathieu Boespflug
Category Control
Home page
Source repo head: git clone
Uploaded Tue Feb 6 12:21:14 UTC 2018 by FacundoDominguez
Distributions LTSHaskell:0.3.5, NixOS:0.4.0, Stackage:0.4.0, openSUSE:0.3.5
Downloads 1633 total (109 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-02-06 [all 1 reports]
Hackage Matrix CI




Maintainer's Corner

For package maintainers and hackage trustees

Readme for distributed-closure-0.4.0

[back to package description]


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.


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.