Writing a State Monad

In this recipe, we will write our own State Monad. We will use the state monad to store the effect of cursor movements.