package DX::ResolutionStrategy;
use DX::Resolution;
+use Types::Standard qw(CodeRef Tuple slurpy);
use DX::Class;
-has action_prototypes => (is => 'ro', required => 1);
+has action_prototypes => (
+ is => 'ro', required => 1,
+ isa => ArrayRef[Tuple[Value, Str, slurpy ArrayRef[Value]]]
+);
-has veracity_depends_on_builder => (is => 'ro', required => 1);
+has veracity_depends_on_builder => (
+ is => 'ro', required => 1, isa => CodeRef
+);
-has implementation_candidates => (is => 'ro', required => 1);
-
-has aperture => (is => 'lazy', builder => sub {
- my ($self) = @_;
- return [
- # [ $thing, 'set_value' ] -> $thing->aperture_for_set_value
- map @{$_->[0]->${\'aperture_for_'.$_[1]}()},
- @{$self->action_prototypes}
- ];
-});
+has implementation_candidates => (
+ is => 'ro', required => 1, isa => ArrayRef[ArrayRef[ArrayRef[Value]]]
+);
sub next_resolution {
my ($self) = @_;
sub for_deparse {
my ($self) = @_;
- [ statement => [
- [ symbol => 'resolution_strategy' ],
+ [ word_and_body => [
+ 'resolution_strategy',
[ pairs => [
[ action_prototypes => [ block => [
map {
] ]
} @{$self->action_prototypes}
] ] ],
- [ implementation_candidates => [ block => [
- map [ block => [
- map [ block => [
+ [ implementation_candidates => [ list => [
+ map [ list => [
+ map [ list => [
map +($_->value_path ? [ value_path => $_->value_path ] : $_), @$_
] ], @$_
] ], @{$self->implementation_candidates}