Since next_coin is to be repeated until it is given an amount of 0, we can write
So recurs can be used the same places next_coin can. Only it will repeat next_coin the right number of times.
Although we won't be implementing the dispense function, we will need a stub to run our program. The basic idea is to do this
but that will not work in the context of a StMach monad. We need to lift to the wrapping IO monad this way: