NAME Data::Monad::CondVar - The CondVar monad. SYNOPSIS use
Data::Monad::CondVar; # The sleep sort my @list = (3, 5, 2, 4,
9, 1, 8); my @result; AnyEvent::CondVar->all( map {
cv_unit($_)->sleep($_ / 1000) ->map(sub { push @result, @_ }); }
@list )->recv; DESCRIPTION Data::Monad::CondVar adds monadic
operations to AnyEvent::CondVar. Since this module extends
AnyEvent::CondVar directly, you can call monadic methods
anywhere there are CondVars. This module is marked EXPERIMENTAL.
API could be changed without any notice. METHODS $cv =
as_cv($cb->($cv)) A helper for rewriting functions using
callbacks to ones returning CVs. my $cv = as_cv { http_get "",
$_[0] }; my ($data, $headers) = $cv->recv; $cv = cv_unit(@vs)
$cv = cv_zero() $cv = cv_fail($v) $f = cv_flat_map_multi(\&f,
$cv1, $cv2, ...) $f = cv_map_multi(\&f, $cv1, $cv2, ...) $cv =
cv_sequence($cv1, $cv2, ...) These are shorthand of methods
which has the same name. $cv = call_cc($f->($cont)) Calls $f
with current continuation, $cont. $f must return a CondVar