using RefMonad in iterate