foldr versus the State Monad