Example distributed-process + snap application
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Peter J. Jones 9f53b212d5 Ignore cabal sandbox 6 years ago
src Add a web page to show off the web server 6 years ago
www If the web server node dies clear the table of nodes 6 years ago
.gitignore Ignore cabal sandbox 6 years ago
LICENSE Initial commit 6 years ago
README.md Add a README 6 years ago
Setup.hs Initial commit 6 years ago
distinfo.cabal No longer need TemplateHaskell extension 6 years ago
distinfo.hs Get this damn thing working! 6 years ago


Example distributed-process + snap application

A peer-based distributed application written in Haskell with an embedded web server.

This example application is different than a traditional distributed-process application because it doesn’t use a master/slave configuration. Instead, all peers are equal and notify one another of their existence.


Not many. It’s intentionally very minimal.

  • After starting, the application will discover peers on the local network and request from each a reply containing basic information (hostname, OS, etc.).

  • When a node receives a request for information it records the existence of the requesting peer in a mutable map. It also begins monitoring the peer for failure.

  • If a node dies or terminates peers will remove the deceased node from their node maps.

  • Nodes that were started with the -w flag include a web server on port 8000 (use -W to use another port.) Browsing to that port on localhost will show an automatically updating list of peers.


  • When running nodes on different machines you must use the -H flag to set your public IP address so other peers can see you. It would be nice if this was automatically set.

  • On the other hand, when running more than one node on the same machine you need to use the -n flag to specify a port number so that each node has a unique port.

  • I’ve stripped out all use of Template Haskell from this application, including the remotable table. Therefore you can’t spawn processes on remote nodes.

Building and Installing

  1. Install the Haskell Platform.

  2. Install cabal-dev:

    $ cabal update
    $ cabal install cabal-dev
  3. Build distinfo:

    $ cd distinfo
    $ cabal-dev install
  4. Play with it:

    $ cabal-dev/bin/distinfo --help