NAME
Data::Monad::Singleton - The singleton monad.
SYNOPSIS
my
$singleton
= Data::Monad::Singleton->unit(
"Hello"
)
->flat_map(
sub
{
length
$_
[0] });
$singleton
== singleton and
die
"All operations are ignored."
;
DESCRIPTION
Data::Monad::Singleton maps all values to the one value. It collapses the structure of original computations.
METHODS
- $m = singleton;
-
Represents the value of this class.
- $m = Data::Monad::Singleton->new;
-
Represents the value of this class.
- unit
- flat_map
-
Overrides methods of Data::Monad::Base::Monad.
AUTHOR
hiratara <hiratara {at} cpan.org>
SEE ALSO
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.