Lightweight, modular, and extensible library for functional programming in Scala
open sourceMITself-hostablefree
Cats is a library of functional programming abstractions for Scala: type classes such as Functor, Applicative, Monad, Traverse and Semigroup, data types such as Validated, NonEmptyList, Kleisli and the monad transformers, and syntax that makes them pleasant to use. It aims to be core, binary compatible, modular, approachable and efficient, and is the foundation of the Typelevel ecosystem of pure, typeful libraries such as Cats Effect, fs2, http4s and Doobie. The name shortens "category", but you don't need category theory to use it. It runs on the JVM, Scala.js and Scala Native, and is MIT licensed.
Problems it solves
- write pure functional Scala with standard Monad, Functor and Traverse type classes instead of rolling my own
- collect every validation error at once instead of stopping at the first
- traverse a list of Options or Futures and get back an Option or Future of a list
- combine nested effects like Future of Either without writing nested maps
- a non-empty list type so the compiler proves the list has at least one element
- a shared foundation of type classes that my Scala libraries and my team's code all agree on
- learn functional programming patterns in Scala with an approachable library and docs
Features
- type classes: Functor, Applicative, Monad, Traverse, Foldable, Semigroup, Monoid and more
- data types: Validated, NonEmptyList, Chain, Kleisli, Ior, EitherT, OptionT
- syntax extensions with a single import
- laws modules to test type class instances
- Free monads (cats-free), Algebra and Alleycats modules
- JVM, Scala.js and Scala Native builds
- binary compatibility within a major version
Capabilities
| Has official SDKs | plan not known |
|---|
