The goal is to provide a lightweight, modular, and extensible library that is approachable and powerful. We will also provide useful documentation and examples which are type-checked by the compiler to ensure correctness.
Cats will be designed to use modern best practices:
- simulacrum for minimizing type class boilerplate
- machinist for optimizing implicit operators
- scalacheck for property-based testing
- discipline for encoding and testing laws
- kind-projector for type lambda syntax
- algebra for shared algebraic structures
- ...and of course a pure functional subset of the Scala language.
(We also plan to support Miniboxing in a branch.)
Currently Cats is experimenting with providing laziness via a type
constructor (Eval[_]
), rather than via ad-hoc by-name
parameters. This design may change if it ends up being impractical.
The goal is to make Cats as efficient as possible for both strict and lazy evaluation. There are also issues around by-name parameters that mean they are not well-suited to all situations where laziness is desirable.
Cats will be split into modules, both to keep the size of the artifacts down and also to avoid unnecessarily tight coupling between type classes and data types.
Cats provides the following modules:
core
: Definitions for widely-used type classes and data types.laws
: The encoded laws for type classes defined incore
, exported to assist third-party testing.kernel
: Definitions for the basic algebraic type classeskernel-laws
: The encoded laws for type classes defined inkernel
, exported to assist third-party testing.free
: Free structures such as the free monad, and supporting type classes.macros
: Macro definitions needed forcore
and other projects.tests
: Verifies the laws, and runs any other tests. Not published.bench
: Benchmarking suites. Not published.
As the type class families grow, it's possible that additional modules will be added as well. Modules which depend on other libraries (e.g. Shapeless-based type class derivation) may be added as well.