Working with Cloud Haskell
So far, we have seen multi-threaded concurrency. In this recipe, we will look at distributed concurrency, where the concurrency can be achieved through multiple processes either on the same machine or a cluster of machines. In this recipe, we will create a local node and communicate with it using tcp transport.
Getting ready
We will use cloud-haskell libraries for this.
How to do it...
- Create a new project called
working-with-cloud-haskellwith thesimplestack template:
stack new working-with-cloud-haskell simple
- Add a dependency on the
distributed-processlibrary in thebuild-dependssub-section ofexecutablesection. Also add support libraries and the-threadedoption toghc-options:
executable working-with-cloud-haskell
hs-source-dirs: src
main-is: Main.hs
ghc-options: -threaded
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
...