switch to preserving original step in alt list
[scpubgit/DX.git] / lib / DX / Step / Backtrack.pm
CommitLineData
55131db4 1package DX::Step::Backtrack;
2
3use DX::Class;
4
5with 'DX::Role::Step';
6
7sub apply_to {
8 my ($self, $ss) = @_;
9 my ($first_alt, @rest_alt) = @{$ss->alternatives};
6a0483ff 10 return $ss->but(next_step => $ss->on_exhaustion_step) unless $first_alt;
55131db4 11 return $ss->but(
38113b88 12 current_hypothesis => $first_alt->[1],
55131db4 13 alternatives => \@rest_alt,
38113b88 14 next_step => $first_alt->[0]->alternative_step,
282b1d76 15 is_solution_state => 0,
55131db4 16 );
17}
18
191;