NAME
FunctionalPerl - functional programming on Perl
SYNOPSIS
use FunctionalPerl;
FunctionalPerl->VERSION # or $FunctionalPerl::VERSION
# But all the actual modules are under FP::*, like:
use FP::List;
# etc.
# But you can also import sets of modules from here, e.g.:
use FunctionalPerl qw(:sequences :repl);
DESCRIPTION
Allow Perl programs to be written with fewer side effects.
See the Functional Perl home page.
EXPORTS
FunctionalPerl also acts as a convenience re-exporter, offering tags to load sets of modules.
Note that the tags and the sets of modules are very much alpha. If you want to have a better chance of code not breaking, import the modules you want directly.
The following export tags are currently supported:
# Export tag to modules and/or other tags; each module will be
# imported with ":all" by default. Where a module name contains "=",
# the part after the "=" is the comma-separated list of tag names to
# import.
our $export_desc=
+{
":autobox"=> [qw(FP::autobox=)],
":stream"=> [qw(FP::Stream FP::IOStream FP::Weak)],
":lazy"=> [qw(FP::Lazy :stream FP::Weak)],
":transparentlazy"=> [qw(FP::TransparentLazy :stream)],
":failure"=> [qw(FP::Failure)],
":show"=> [qw(FP::Show)],
":equal"=> [qw(FP::Equal)],
":debug"=> [qw(:show :equal Chj::Backtrace Chj::time_this Chj::pp)],
":test"=> [qw(Chj::TEST)],
":repl"=> [qw(FP::Repl FP::Repl::AutoTrap)],
":dev"=> [qw(:repl :test :debug Chj::ruse)],
":functions"=> [qw(FP::Combinators FP::Ops FP::Div
FP::Optional FP::Values
FP::Memoizing FP::uncurry
FP::Untainted
:show :equal :failure)],
":git"=> [qw(FP::Git::Repository)],
":pxml"=> [qw (PXML::Util PXML::XHTML PXML::Serialize)],
":chars"=> [qw(FP::Char)],
":sequences"=> [qw(FP::List FP::StrictList FP::MutableArray
FP::Array FP::Array_sort
FP::PureArray
:stream)],
":maps"=> [qw(FP::Hash)],
":sets"=> [qw(FP::HashSet FP::OrderedCollection)],
":tries"=> [qw(FP::Trie)],
":datastructures"=> [qw(:chars :sequences :maps :sets :tries)],
":io"=> [qw(Chj::xIO Chj::xopen Chj::xtmpfile= Chj::tempdir
Chj::xpipe= Chj::xoutpipe= Chj::xopendir= Chj::xperlfunc
Chj::xhome
FP::IOStream)],
":dbi"=> [qw(FP::DBI=)],
":csv"=> [qw(FP::Text::CSV)],
":fix"=> [qw(FP::fix)],
":trampoline"=> [qw(FP::Trampoline)],
":path"=> [qw(FP::Path)],
":most"=> [qw(:lazy :datastructures :equal :show :functions :failure :debug
:autobox)],
":rare"=> [qw(:csv :path :git :dbi :trampoline :fix)],
":all"=> [qw(:most :rare :io :dev)],
};
Tags can be expanded via:
my ($modules, $unused_tags)= FunctionalPerl::expand(qw(:dev :most));
is $$modules{"FP::Failure"}, 2; # number of times used.
use FP::Equal 'is_equal';
is_equal $unused_tags,
[':all', ':csv', ':dbi', ':fix', ':git', ':io', ':path', ':pxml', ':rare', ':trampoline', ':transparentlazy'];
NOTE
This is alpha software! Read the package README.