Skip to content

Commit

Permalink
Implement Promise.Supply.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Aug 19, 2015
1 parent 7bf7457 commit 1f15ace
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/core/Promise.pm
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ my class Promise {
}
$p
}

method Supply(Promise:D:) {
my $s = Supply.new;
self.then({
if self.status == Kept {
$s.emit(self.result);
$s.done();
}
else {
$s.quit(self.cause);
}
});
$s
}
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit 1f15ace

Please sign in to comment.