FunctionalPerl - functional programming in Perl


    use FunctionalPerl;
    FunctionalPerl->VERSION # or $FunctionalPerl::VERSION

    # The actual modules are in the FP:: namespace hierarchy, like:
    use FP::List;

    # But you can also import sets of modules from here, e.g.:
    use FunctionalPerl qw(:sequences :repl);


Allows Perl programs to be written with fewer side effects.

See the Functional Perl home page.


FunctionalPerl also acts as a convenience re-exporter, offering tags to load sets of modules. (It also has one normal export: `expand_import_tags`, see below.)

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.

Tags can be expanded via:

    use FunctionalPerl qw(expand_import_tags);
    my ($modules, $unused_tags, $nontags) = expand_import_tags(qw(:dev :most not_a_tag));
    is $$modules{"FP::Failure"}, 2; # number of times used.
    is_deeply $unused_tags,
              [':all', ':ast', ':csv', ':dbi', ':fix', ':git', ':io', ':paths', ':pxml', ':rare', ':trampolines', ':transparentlazy'];
    is_deeply $nontags, ['not_a_tag'];


This is the list of supported import tags and the modules and other tags that they import:

:all -> :dev, :io, :most, :rare

:ast -> FP::AST::Perl

:autobox -> FP::autobox

:chars -> FP::Char

:csv -> FP::Text::CSV

:datastructures -> :chars, :maps, :numbers, :sequences, :sets, :tries

:dbi -> FP::DBI

:debug -> :equal, :show, Chj::Backtrace, Chj::pp, Chj::time_this

:dev -> :debug, :repl, :test, Chj::ruse

:doc -> FP::Docstring

:equal -> FP::Equal

:failures -> FP::Either, FP::Failure

:fix -> FP::fix

:functions -> :equal, :failures, :show, FP::Combinators, FP::Combinators2, FP::Currying, FP::Div, FP::Memoizing, FP::Ops, FP::Optional, FP::Predicates, FP::Untainted, FP::Values

:git -> FP::Git::Repository

:io -> Chj::tempdir, Chj::xIO, Chj::xhome, Chj::xopen, Chj::xopendir, Chj::xoutpipe, Chj::xperlfunc, Chj::xpipe, Chj::xtmpfile, FP::IOStream

:lazy -> :streams, FP::Lazy, FP::Weak

:maps -> FP::Hash, FP::PureHash

:most -> :autobox, :datastructures, :debug, :doc, :equal, :failures, :functions, :lazy, :show

:numbers -> FP::BigInt

:paths -> FP::Path

:pxml -> PXML::Serialize, PXML::Util, PXML::XHTML

:rare -> :csv, :dbi, :fix, :git, :paths, :trampolines

:repl -> FP::Repl, FP::Repl::AutoTrap

:sequences -> :streams, FP::Array, FP::Array_sort, FP::List, FP::MutableArray, FP::PureArray, FP::SortedPureArray, FP::StrictList

:sets -> FP::HashSet, FP::OrderedCollection

:show -> FP::Show

:streams -> FP::IOStream, FP::Stream, FP::Weak

:test -> Chj::TEST

:trampolines -> FP::Trampoline

:transparentlazy -> :streams, FP::TransparentLazy, FP::Weak

:tries -> FP::Trie


This is alpha software! Read the status section in the package README or on the website.