package Data::Perl::Collection::Set;

use Moose;
use Method::Signatures::Simple;
use Data::Perl::Stream::Array;

has '_members' => (is => 'ro', required => 1, init_arg => 'members');

method map ($fun) {
  (ref $self)->new(
    members => [ map $fun->($_), @{$self->_members} ]
  )
}

method to_stream {
  Data::Perl::Stream::Array->new(array => [ @{$self->_members} ])
}

__PACKAGE__->meta->make_immutable;

1;
