Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 853 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 853 Bytes

Monads in C++

Some common monads are easy to implement in C++.

Note that the implementations for 'Maybe' and 'Result' in this repository do not strictly encapsulate the values. It is possible to check if there is a value in the Maybe, and unwrap it manually. Strictly speaking, this should not be allowed, and instead 'bind' or function lifting should be used to raise all functions into the monadic context. Since this is often non-trivial in C++, i.e. the possibility to manually unwrap the values has been left open.

Getting started

  1. Install dependencies
sudo apt get install g++ cmake libgtest-dev
  1. Clone the repo
git clone #...
cd #... navigate into the freshly cloned repo
  1. Build and run:
mkdir out && cd out && cmake .. && cd .. # out-of-source build
cmake --build out/ && ./out/unit_tests