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.
Using closure to communicate between nodes
How to do it...
- Create a new project called master-slave with the simple stack template:
stack new using-closure simple
- Add a dependency on the distributed-process and distributed-process-localnet libraries in the build-depends sub-section of the executable section:
executable using-closure
hs-source-dirs: src
main-is: Main.hs
ghc-options: -threaded
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
...