Skip to content
A brief exploration of the various approaches to modeling side effects in a purely functional programming language.
Branch: master
Clone or download
Pull request Compare This branch is 9 commits ahead, 8 commits behind stepchowfun:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
scripts
src
test
.gitignore
.travis.yml
LICENSE
Makefile
README.md
Setup.hs
effects.cabal
stack.yaml

README.md

Effects

A brief exploration of the various approaches to modeling side effects in a purely functional programming language.

Build Status

The challenge

Write a program that initializes an accumulator and random seed both with 0 and then runs the following procedure 10 times:

  • Log the value of the accumulator.
  • Pick an integer uniformly randomly from the half-open interval [0, 10).
  • Mutate the accumulator by adding the random integer to it.

Thus, 3 computational effects are exhibited: logging, randomness, and mutable state.

Techniques demonstrated

This repository contains 4 implementations of the program described above, each demonstrating a specific technique:

Instructions

Make sure you have Make and Stack installed. Then you can use this command to run the demo:

make run
You can’t perform that action at this time.