state -- represent a state using a monad
this can be used both a plain or as a oneway monad to store a state
in a way orthogonal to the actual compuation.
converts option to a string
returns the result of $T for an option containing an instance
of T, alternatively returns $nil for an option that is nil.
Same as non-generic >>=, but also maps to a different type B.
redefines monad.infix >>=:
monadic operator within the same monad
Apply f to elements of type A and re-wrap them in this monad.
map this using f
modify the state, leaving the contents unchanged