state monad attempt