switch next predicate to mutating searchstate instead of using alt_step
[scpubgit/DX.git] / lib / DX / Step / InvokeNextPredicate.pm
index f4a68dd..dc9aab1 100644 (file)
@@ -4,9 +4,15 @@ use DX::Class;
 
 with 'DX::Role::Step';
 
+has proposition => (is => 'ro', required => 1);
+
 sub apply_to {
-  my ($self, $hyp) = @_;
-  return (undef, $hyp->head_proposition->resolve_for($hyp->scope));
+  my ($self, $ss) = @_;
+  my $hyp = $ss->current_hypothesis;
+  if (my $step = $self->proposition->resolve_for($hyp->scope)) {
+    return $ss->but(next_step => $step);
+  }
+  return undef;
 }
 
 1;