line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Monad::Base::MonadZero; |
2
|
10
|
|
|
10
|
|
1100
|
use strict; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
314
|
|
3
|
10
|
|
|
10
|
|
47
|
use warnings; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
234
|
|
4
|
10
|
|
|
10
|
|
7074
|
use parent qw/Data::Monad::Base::Monad/; |
|
10
|
|
|
|
|
3100
|
|
|
10
|
|
|
|
|
50
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub zero { |
7
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
8
|
0
|
|
|
|
|
0
|
die "You should override this method."; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub filter { |
12
|
9
|
|
|
9
|
1
|
14
|
my ($self, $predicate) = @_; |
13
|
|
|
|
|
|
|
$self->flat_map(sub { |
14
|
22
|
100
|
|
22
|
|
47
|
$predicate->(@_) ? (ref $self)->unit(@_) : (ref $self)->zero; |
15
|
9
|
|
|
|
|
60
|
}); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
1; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
__END__ |