line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Monad::List; |
2
|
8
|
|
|
8
|
|
7969
|
use strict; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
778
|
|
3
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
224
|
|
4
|
8
|
|
|
8
|
|
42
|
use Exporter qw/import/; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
282
|
|
5
|
8
|
|
|
8
|
|
41
|
use base qw/Data::Monad::Base::MonadZero/; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
5331
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw/scalar_list list_unit list_zero list_flat_map_multi |
8
|
|
|
|
|
|
|
list_map_multi list_sequence/; |
9
|
|
|
|
|
|
|
|
10
|
50
|
|
|
50
|
1
|
1626
|
sub scalar_list(@) { __PACKAGE__->new(map { [$_] } @_) } |
|
95
|
|
|
|
|
385
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
1
|
15
|
sub list_unit { __PACKAGE__->unit(@_) } |
13
|
0
|
|
|
0
|
1
|
0
|
sub list_zero { __PACKAGE__->zero(@_) } |
14
|
1
|
|
|
1
|
1
|
17
|
sub list_flat_map_multi(&@) { __PACKAGE__->flat_map_multi(@_) } |
15
|
1
|
|
|
1
|
1
|
15
|
sub list_map_multi(&@) { __PACKAGE__->map_multi(@_) } |
16
|
1
|
|
|
1
|
1
|
17
|
sub list_sequence { __PACKAGE__->sequence(@_) } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
220
|
|
|
220
|
1
|
1076
|
my $class = shift; |
20
|
220
|
|
|
|
|
1438
|
bless [@_], $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub unit { |
24
|
92
|
|
|
92
|
1
|
431
|
my $class = shift; |
25
|
92
|
|
|
|
|
247
|
$class->new([@_]); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub zero { |
29
|
8
|
|
|
8
|
1
|
53
|
my $class = shift; |
30
|
8
|
|
|
|
|
15
|
$class->new(); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub flat_map { |
34
|
65
|
|
|
65
|
1
|
96
|
my ($self, $f) = @_; |
35
|
65
|
|
|
|
|
190
|
(ref $self)->new(map { @{$f->(@$_)} } @$self); |
|
149
|
|
|
|
|
183
|
|
|
149
|
|
|
|
|
490
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub values { |
39
|
11
|
|
|
11
|
1
|
18
|
my $self = shift; |
40
|
11
|
|
|
|
|
34
|
@$self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub scalars { |
44
|
10
|
|
|
10
|
1
|
19
|
my $self = shift; |
45
|
58
|
50
|
|
|
|
124
|
map { |
46
|
10
|
|
|
|
|
29
|
@$_ == 1 or die "contained multiple values."; |
47
|
58
|
|
|
|
|
154
|
@$_; |
48
|
|
|
|
|
|
|
} $self->values; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |