with 'DX::Role::ActionPolicy';
-has lock_to_depth => (is => 'ro', required => 1);
+has lock_to_depth => (is => 'ro', required => 1, isa => Int);
-has next_policy => (is => 'ro', required => 1);
+has next_policy => (is => 'ro', required => 1, isa => ActionPolicy);
sub allows {
my ($self, $action) = @_;
has deps => (is => 'ro', isa => DependencyTree, required => 1);
-has revdeps => (is => 'ro', required => 1);
+has revdeps => (is => 'ro', required => 1, isa => HashRef[DependencyList]);
sub new_empty {
my ($class) = @_;
use DX::Utils qw(:all);
use DX::Value::True;
use DX::Value::False;
+use Types::Standard qw(InstanceOf);
use Tcl;
use DX::Class;
has tcl => (
- is => 'lazy', builder => sub { Tcl->new },
+ is => 'lazy', builder => sub { Tcl->new }, isa => InstanceOf['Tcl'],
handles => { _split_list => 'SplitList' },
);
with 'DX::Role::Predicate';
-has arg_names => (is => 'ro', required => 1);
+has arg_names => (is => 'ro', required => 1, isa => ArrayRef[Str]);
-has proposition_sequence => (is => 'ro', required => 1);
+has proposition_sequence => (
+ is => 'ro', required => 1, isa => PropositionSequence
+);
1;
is => 'ro', isa => PropositionSequence, required => 1
);
-has search_state => (
- is => 'lazy', builder => sub {
- $_[0]->new_search_state_for($_[0]->proposition_sequence)
- },
+has search_process => (
+ is => 'lazy', isa => SearchProcess, builder => sub {
+ $_[0]->new_search_process_for($_[0]->proposition_sequence)
+ }, handles => { search_state => 'current_search_state' },
);
-sub new_search_state_for {
+sub new_search_process_for {
my ($self, $prop_seq) = @_;
my @local_names = map { keys %{$_->introduced_names} }
@{$prop_seq->members};
my ($self, $prop) = @_;
my $prop_seq = $self->proposition_sequence
->with_additional_proposition($prop);
- my $sol_ss = $self->new_search_state_for($prop_seq)
+ my $sol_ss = $self->new_search_process_for($prop_seq)
->find_solution;
die "No solution\n" unless $sol_ss;
$self->but(
proposition_sequence => $prop_seq,
- search_state => $sol_ss,
+ search_process => $sol_ss,
);
}
sub with_forced_backtrack {
my ($self) = @_;
- my $next_ss = $self->search_state->find_next_solution;
+ my $next_ss = $self->search_process->find_next_solution;
die "No next solution\n" unless $next_ss;
- $self->but(search_state => $next_ss);
+ $self->but(search_process => $next_ss);
}
1;
is => 'ro', required => 1, isa => ArrayRef[ArrayRef[ArrayRef[Value]]]
);
-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}
- ];
-});
-
sub next_resolution {
my ($self) = @_;
return undef unless my ($first) = @{$self->implementation_candidates};
use DX::Predicate::Rule;
use DX::Class;
-has arg_names => (is => 'ro', required => 1);
+has arg_names => (is => 'ro', required => 1, isa => ArrayRef[Str]);
-has proposition_sequence => (is => 'rwp', lazy => 1, builder => sub {
- my ($self) = @_;
- my %arg_names = map +($_ => 1), @{$self->arg_names};
- DX::PropositionSequence->new_empty
- ->but(external_names => \%arg_names);
-});
+has proposition_sequence => (
+ is => 'rwp', lazy => 1, isa => PropositionSequence,
+ builder => sub {
+ my ($self) = @_;
+ my %arg_names = map +($_ => 1), @{$self->arg_names};
+ DX::PropositionSequence->new_empty
+ ->but(external_names => \%arg_names);
+ }
+);
-has expander => (is => 'ro', required => 1, handles => [ qw(expand_args) ]);
+has expander => (
+ is => 'ro', required => 1, isa => Expander, handles => [ qw(expand_args) ]
+);
sub apply_predicate {
my ($self, $pred, @arg_strings) = @_;
handles => [ qw(is_complete_command_string eval_command_string) ]
);
-has session_mode => (is => 'rwp', isa => Enum['shell','query'], required => 1);
+has session_mode => (is => 'rwp', isa => ShellMode, required => 1);
has readline => (
is => 'lazy', isa => InstanceOf['Caroline'],
has expander => (
is => 'lazy', builder => sub { DX::Expander->new(tcl => $_[0]->tcl) },
- isa => InstanceOf['DX::Expander'], handles => [ qw(expand_args) ],
+ isa => Expander, handles => [ qw(expand_args) ],
);
has tcl => (is => 'lazy', isa => InstanceOf['Tcl'], builder => sub {
);
has current_query_state => (
- is => 'lazy', builder => 'new_query_state'
+ is => 'lazy', builder => 'new_query_state', isa => QueryState
);
has trace_these => (
- is => 'ro', required => 1,
+ is => 'ro', required => 1, isa => HashRef[Str],
);
-has mode => (is => 'ro', required => 1);
+has mode => (is => 'ro', required => 1, isa => ShellMode);
sub new_query_state { $_[0]->template_query_state }
(our @CLASSES = qw(
Hypothesis Scope ResolvedPropositionSet Proposition DependencyMap
PropositionSequence QueryState ShellState ShellSession SearchState
- ResolutionSpace ResolutionStrategy Resolution
+ ResolutionSpace ResolutionStrategy Resolution Expander SearchProcess
)),
(our @ROLES = qw(
Step Action ActionPolicy Predicate Value ActionBuilder Update
qw(
DependencyType _DependencyTree DependencySpec
One DependencyGroupEntry DependencyGroup ValuePath
- EventType ApertureList DependencyList
+ EventType ApertureList DependencyList ShellMode
),
)
;
use Type::Utils -all;
use Types::Standard qw(
- ArrayRef Tuple HashRef Dict Maybe Optional slurpy Str
+ ArrayRef Tuple HashRef Dict Maybe Optional slurpy Str Enum
);
use DX::Utils qw(:event_types :dep_types);
declare ApertureList => as ArrayRef[Tuple[EventType, slurpy ValuePath]];
+declare ShellMode => as Enum[qw(shell query)];
+
## These were from the dependency group thing which makes no sense until
## we have scoping, so revisit it then
#