Using foldr to carry Ant ID state along with it