Refinement Types is an actively used design pattern. A type endowed with a predicate which is assumed to hold for any element of the refined type.

?Years Old

Languages with Refinement Types include raku

Example from raku:

subset Color of Any where Color | CMYK_Color;

Last updated June 22nd, 2020

Edit Refinement Types on GitHub