line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Monad::List; |
2
|
8
|
|
|
8
|
|
3483
|
use strict; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
251
|
|
3
|
8
|
|
|
8
|
|
30
|
use warnings; |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
193
|
|
4
|
8
|
|
|
8
|
|
28
|
use Exporter qw/import/; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
239
|
|
5
|
8
|
|
|
8
|
|
32
|
use base qw/Data::Monad::Base::MonadZero/; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
3288
|
|
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
|
722
|
sub scalar_list(@) { __PACKAGE__->new(map { [$_] } @_) } |
|
95
|
|
|
|
|
203
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
1
|
12
|
sub list_unit { __PACKAGE__->unit(@_) } |
13
|
0
|
|
|
0
|
1
|
0
|
sub list_zero { __PACKAGE__->zero(@_) } |
14
|
1
|
|
|
1
|
1
|
11
|
sub list_flat_map_multi(&@) { __PACKAGE__->flat_map_multi(@_) } |
15
|
1
|
|
|
1
|
1
|
13
|
sub list_map_multi(&@) { __PACKAGE__->map_multi(@_) } |
16
|
1
|
|
|
1
|
1
|
11
|
sub list_sequence { __PACKAGE__->sequence(@_) } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
220
|
|
|
220
|
1
|
781
|
my $class = shift; |
20
|
220
|
|
|
|
|
957
|
bless [@_], $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub unit { |
24
|
92
|
|
|
92
|
1
|
294
|
my $class = shift; |
25
|
92
|
|
|
|
|
152
|
$class->new([@_]); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub zero { |
29
|
8
|
|
|
8
|
1
|
47
|
my $class = shift; |
30
|
8
|
|
|
|
|
14
|
$class->new(); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub flat_map { |
34
|
65
|
|
|
65
|
1
|
66
|
my ($self, $f) = @_; |
35
|
65
|
|
|
|
|
162
|
(ref $self)->new(map { @{$f->(@$_)} } @$self); |
|
149
|
|
|
|
|
108
|
|
|
149
|
|
|
|
|
256
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub values { |
39
|
11
|
|
|
11
|
1
|
16
|
my $self = shift; |
40
|
11
|
|
|
|
|
25
|
@$self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub scalars { |
44
|
10
|
|
|
10
|
1
|
13
|
my $self = shift; |
45
|
58
|
50
|
|
|
|
96
|
map { |
46
|
10
|
|
|
|
|
24
|
@$_ == 1 or die "contained multiple values."; |
47
|
58
|
|
|
|
|
109
|
@$_; |
48
|
|
|
|
|
|
|
} $self->values; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |