introduce next_step method to rspace
[scpubgit/DX.git] / lib / DX / Step / ConsiderProposition.pm
CommitLineData
86dbedb6 1package DX::Step::ConsiderProposition;
e647e417 2
3use DX::Class;
4
5with 'DX::Role::Step';
6
f9dfc310 7has proposition => (is => 'ro', isa => Proposition, required => 1);
ccf0d4fe 8
e647e417 9sub apply_to {
110fd002 10 my ($self, $ss) = @_;
11 my $hyp = $ss->current_hypothesis;
5b6cab1b 12 trace consider => [
13 statement => [
14 [ symbol => 'consider' ],
15 @{$self->proposition->for_deparse->[1]},
16 ],
17 ];
c75a6803 18 if (my $step = $self->proposition->resolve_for($hyp->scope)) {
19 return $ss->but(next_step => $step);
20 }
c76de01d 21 return $ss->but(next_step => DX::Step::Backtrack->new);
e647e417 22}
23
241;