No description, website, or topics provided.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A library implementing the Carol programming language, providing an eDSL for writing operations and a replica system that runs them.

Quick start

First, get the project.

$ git clone
$ cd card-systems

Next, build the project. If you have the nix package manager, the process is simple:

$ nix-env -i cabal2nix cabal-install
$ cabal2nix --shell . > shell.nix
$ nix-shell --command "cabal configure"
$ cabal build

The current demo executable is a simple conflict-aware bank account, in which replicas announce updates via http and store their history in IPFS. To try it, first make sure there is an IPFS daemon running with it's API on port 5001 (the default).

$ nix run nixpkgs.ipfs -c ipfs daemon --init

Then, open two terminals, and run the following:

(term 1)$ cabal run discard-demo -- -c 2local.yaml -i alpha

(term 2)$ cabal run discard-demo -- -c 2local.yaml -i beta

Now a node is running in each terminal. Choose one and type check to see the current shared account value (0 to start). Add money with dp INT, withdraw with wd INT.

Try testing the safety of the system by running wd INT with enough value to empty the account simultaneously on two nodes.

You can edit Main.hs to see how the library is used and make a more interesting example. The bank operations are implemented in Bank.hs.

Library documentation, which is still minimal and disorganized, can be compiled with cabal haddock.

Alternate setup

If you don't have Nix, here's another way to set up the system (that hasn't been tested in a while...)

  1. Install ipfs
  2. Install stack
  3. Execute the following command within the repo:
    $ stack setup
  4. To build and run the code, use the commands,
    $ stack build
    $ stack exec cardr