Custom Measures
To make a custom Measure, you can use this incantation:
GetMeaUnit('nmile').NewType('Reach');
class Reach is Measure {
has $.units where *.name eq <nm nmile nmiles>.any;
#| override .in to perform identity 1' (Latitude) == 1 nmile
method in( Str $s where * eq <Latitude> ) {
my $nv = $.value / 60;
Latitude.new( value => $nv, compass => <N> )
}
}
This gives type => Length, Reach