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-slavewith thesimplestack template:
stack new using-closure simple
- Add a dependency on the
distributed-processanddistributed-process-localnetlibraries in thebuild-dependssub-section of theexecutablesection:
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-simplelocalnetAt 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...