Using closure to communicate between nodes
In this recipe, we will start two separate processes, one master and one slave. We will use the master process to spawn a subprocess on a slave node.
How to do it...
- Create a new project called
master-slave
with thesimple
stack template:
stack new using-closure simple
- Add a dependency on the
distributed-process
anddistributed-process-localnet
libraries in thebuild-depends
sub-section of theexecutable
section:
executable using-closure hs-source-dirs: src main-is: Main.hs ghc-options: -threaded default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , distributed-process , distributed-process-simplelocalnet
At the time of writing this recipe, some of the dependencies are not resolved through stackage LTS. Add the following to stack.yaml
:
extra-deps: - distributed...