repl works again
[scpubgit/Tak.git] / lib / Tak / Result.pm
index a7afb4f..38d5e59 100644 (file)
@@ -5,9 +5,13 @@ use Moo;
 has type => (is => 'ro', required => 1);
 has data => (is => 'ro', required => 1);
 
+sub flatten { $_[0]->type, @{$_[0]->data} }
+
+sub is_success { $_[0]->type eq 'success' }
+
 sub get {
   my ($self) = @_;
-  $self->throw unless $self->type eq 'success';
+  $self->throw unless $self->is_success;
   return wantarray ? @{$self->data} : $self->data->[0];
 }