File Coverage

blib/lib/Data/Focus/Applicative/Identity.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 4 4 100.0
total 31 31 100.0


line stmt bran cond sub pod time code
1             package Data::Focus::Applicative::Identity;
2 19     19   19249 use strict;
  19         28  
  19         700  
3 19     19   86 use warnings;
  19         29  
  19         602  
4 19     19   583 use parent qw(Data::Focus::Applicative);
  19         274  
  19         124  
5              
6             sub new {
7 29376     29376 1 30048 my ($class, $datum) = @_;
8 29376         99352 return bless \$datum, $class;
9             }
10              
11             *pure = *new;
12              
13             sub build {
14 11017     11017 1 14152 my ($class, $builder, @f_parts) = @_;
15 11017         12681 return $class->new($builder->(map { $_->run_identity } @f_parts));
  17503         20477  
16             ## should we type-check @f_parts?
17             }
18              
19             sub create_part_mapper {
20 11860     11860 1 13524 my ($class, $updater) = @_;
21 11860     17227   48038 return sub { $class->new($updater->(shift)) };
  17227         27576  
22             }
23              
24             sub run_identity {
25 29373     29373 1 19650 return ${$_[0]};
  29373         60419  
26             }
27              
28             1;
29             __END__