subset PhoneNumber of Int where *.chars == 9; # or any other constraint constant PhoneBook = Hash[PhoneNumber, Str]; # no need to make a class, a type suffices
my %pb is PhoneBook = foo => 123456789; dd %pb; # (my PhoneNumber %{Str} = :foo(123456789))