C++14 functional library
C++ Other
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
cat Missing header. Jul 26, 2018
example/parser Minor changes. Apr 30, 2015
test v1.4: C++17 support enabled. Jul 26, 2018
README.md README update. Jul 26, 2018
install.sh install.sh script added. Apr 28, 2015


Cat: C++14/17 functional library

What is cat?

Cat is a C++14/17 functional library inspired by category theory and Haskell language. The purpose of cat is to provide utility functions and type classes to enable the functional programming paradigm in C++.


The purpose of Cat library is twofold:

  • to provide utility classes and functions that enable the functional programming paradigm in C++.
  • to implement an extensible framework of type classes to attain a better reusability of code through the principles of category theory.


The Cat library:

  • is lightweight. Each function and object shipped with the library takes advantage of modern C++ features, such as constexpr constructs, movability, perfect forwarding, etc.

  • is written in portable C++14/17 without macro black-magic, whereas template meta-programming is restricted only to the implementation of type traits.

  • implements type traits tailored for generic and functional programming (e.g. is_container, is_associative_container, function_type, function_arity, return_type, is_callable to mention a few).

  • provides utilities, like callable wrappers, which enable functional composition and currying on-top-of any kind of callable types (including std::bind expressions and generic lambdas).

  • provides functions that operate on std::tuple and generic containers.

  • provides utilities that enable perfect forwarding from L/R value containers by means of forward_as and forward_iterator.

  • includes an extensible framework for building type classes and provides the implementation of the following ones:

    • Functor
    • Bifunctor
    • Applicative
    • Alternative
    • Monoid
    • Monad
    • MonadPlus
    • Foldable
    • Show
    • Read
    • ...
  • includes instances of standard C++14/17 and Technical Specification (TS) containers/types for the above-mentioned type classes.


At the present moment the Cat library is tested under Linux and MacOS with both glibcxx and libc++ library and with the following compilers:

  • gcc-4.9
  • gcc-5
  • gcc-6.3
  • gcc-8
  • clang-3.5
  • clang 3.6
  • clang 6.0


The Cat library takes inspiration from the following projects: