Represent a Raku type with parameterization
class RakuAST::Type::Parameterized { }
The RakuAST::Type::Parameterized class represents a Raku type with parameterization.
RakuAST::Type::Parameterized object is typically created when parsing Raku Programming Language code. So most developers will only need to know how to introspect the objects created.
dd $type.args; # Str
The args method returns the RakuAST::ArgList object that was specified with the (possibly implicit) "args" named argument in the call to .new.
dd $type.base-type; # Int
The base-type method returns the RakuAST::Type object that was specified with the "base-type" named argument in the call to .new.
say $type.is-coercive; # True or False
The is-coercive method returns whether the base-type is coercive.
There is only one way to create a RakuAST::Type::Parameterized object.
my $type = RakuAST::Type::Parameterized.new(
base-type => RakuAST::Type::Simple.from-identifier("Int"),
args => RakuAST::ArgList.new(
RakuAST::Type::Simple.from-identifier("Str")
)
);
dd $type; # Int(Str)
The .new method creates a RakuAST::Type::Parameterized object. It expects the following named arguments: