has id => (is => 'ro', required => 1);
-has bound_stream => (is => 'ro');
+has root_set => (is => 'ro', predicate => 1);
+
+has bound_stream => (
+ is => 'lazy', predicate => 1, clearer => 1,
+ builder => sub {
+ my ($self) = @_;
+ $self->root_set->to_stream;
+ }
+);
has bound_value => (is => 'lazy', predicate => 1, clearer => 1, builder => sub {
if (defined(my $next = $_[0]->bound_stream->next)) {
sub is_bound {
my ($self) = @_;
- $self->has_bound_value || $self->bound_stream;
+ $self->has_bound_value || $self->has_bound_stream || $self->has_root_set;
}
sub with_stream {
$self->new(%$self, action => $action);
}
+sub with_root_set {
+ my ($self, $set) = @_;
+ $self->new(%$self, root_set => $set);
+}
+
sub copy {
my ($self) = @_;
ref($self)->new(%$self);