add some basic tracing using the new deparser
[scpubgit/DX.git] / lib / DX / Step / ConsiderProposition.pm
1 package DX::Step::ConsiderProposition;
2
3 use DX::Class;
4
5 with 'DX::Role::Step';
6
7 has proposition => (is => 'ro', isa => Proposition, required => 1);
8
9 sub apply_to {
10   my ($self, $ss) = @_;
11   my $hyp = $ss->current_hypothesis;
12   trace consider => [
13     statement => [
14       [ symbol => 'consider' ],
15       @{$self->proposition->for_deparse->[1]},
16     ],
17   ];
18   if (my $step = $self->proposition->resolve_for($hyp->scope)) {
19     return $ss->but(next_step => $step);
20   }
21   return $ss->but(next_step => DX::Step::Backtrack->new);
22 }
23
24 1;