Would this trick help?  You can define a "subset" that restricts
values to the uint16 range:

     my subset FussyUint16 of Int where 0 ..^ 2¹⁶;
     my FussyUint16 $x;
     $x = -1;
     ## Type check failed in assignment to $x; expected FussyUint16
but got Int (-1)

Reply via email to