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', ':all_sequences', ':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
:all
:dev
:io
:most
:rare
:all_sequences -> :primary_sequences, FP::SortedPureArray, FP::StrictList
:all_sequences
:primary_sequences
:ast -> FP::AST::Perl
:ast
:autobox -> FP::autobox
:autobox
:chars -> FP::Char
:chars
:csv -> FP::Text::CSV
:csv
:datastructures -> :chars, :maps, :numbers, :sequences, :sets, :tries
:datastructures
:maps
:numbers
:sequences
:sets
:tries
:dbi -> FP::DBI
:dbi
:debug -> :equal, :show, Chj::Backtrace, Chj::pp, Chj::time_this
:debug
:equal
:show
:dev -> :debug, :repl, :test, Chj::ruse
:repl
:test
:doc -> FP::Docstring
:doc
:equal -> FP::Equal
:failures -> FP::Either, FP::Failure
:failures
:fix -> FP::fix
:fix
:functions -> :equal, :failures, :show, FP::Cmp, FP::Combinators, FP::Combinators2, FP::Currying, FP::Div, FP::Memoizing, FP::Ops, FP::Optional, FP::Predicates, FP::Untainted, FP::Values
:functions
:git -> FP::Git::Repository
:git
: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
:lazy
:streams
:maps -> FP::Hash, FP::PureHash
:most -> :autobox, :datastructures, :debug, :doc, :equal, :failures, :functions, :lazy, :show
:numbers -> FP::BigInt
:paths -> FP::Path
:paths
:pxml -> PXML::Serialize, PXML::Util, PXML::XHTML
:pxml
:rare -> :csv, :dbi, :fix, :git, :paths, :trampolines
:trampolines
:repl -> FP::Repl, FP::Repl::AutoTrap
:sequences -> :streams, FP::Array, FP::Array_sort, FP::List, FP::MutableArray, FP::PureArray
: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
:transparentlazy
:tries -> FP::Trie
This is alpha software! Read the status section in the package README or on the website.
To install FunctionalPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FunctionalPerl
CPAN shell
perl -MCPAN -e shell install FunctionalPerl
For more information on module installation, please visit the detailed CPAN module installation guide.