Cites this verse
Reply to Objection 4: The everlasting punishment of the wicked will not be altogether useless. For they are useful for two purposes. First, because thereby the Divine justice is safeguarded which is acceptable to God for its own sake. Hence Gregory says (Dial. iv): "Almighty God on account of His loving kindness delights not in the torments of the unhappy, but on account of His justice. He is for ever unappeased by the punishment of the wicked." Secondly, they are useful, because the elect rejoice therein, when they see God's justice in them, and realize that they have escaped them. Hence it is written (Ps. 57:12): "The just shall rejoice when he shall see the revenge," etc., and (Is. 66:24): "They," namely the wicked, "shall be a loathsome sight* to all flesh," namely to the saints, as a gloss says. [*"Ad satietatem visionis," which St. Thomas takes to signify being satiated with joy; Cf. Question [94], Article [3]]. Gregory expresses himself in the same sense (Dial. iv): "The wicked are all condemned to eternal punishment, and are punished for their own wickedness. Yet they will burn to some purpose, namely that the just may all both see in God the joys they receive, and perceive in them the torments they have escaped: for which reason they will acknowledge themselves for ever the debtors of Divine grace the more that they will see how the evils which they overcame by its assistance are punished eternally."
Summa Theologiae Supplement, q. 99, a. 1: Whether by Divine justice an eternal punishment is inflicted on sinners? [*Cf. FS, Question [87], Articles [3],4] Reply to Objection 4 (tr. Fathers of the English Dominican Province)