Calculator for the monads
adapted online version from lectures