• Stars
    star
    5,120
  • Rank 7,685 (Top 0.2 %)
  • Language
    Scala
  • License
    Other
  • Created about 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight, modular, and extensible library for functional programming.

Cats

Cats graphic

cats-core Scala version support Continuous Integration Financial Contributors on Open Collective Discord

Overview

Cats is a library which provides abstractions for functional programming in the Scala programming language.

Scala supports both object-oriented and functional programming, and this is reflected in the hybrid approach of the standard library. Cats strives to provide functional programming abstractions that are core, binary compatible, modular, approachable and efficient. A broader goal of Cats is to provide a foundation for an ecosystem of pure, typeful libraries to support functional programming in Scala applications.

For more detail about Cats' motivations, go here.

Why "cats"?

The name is a playful shortening of the word category, from "category theory".

Regardless, you do not need to know anything about category theory to use Cats.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. We welcome contributions to Cats and would love for you to help build Cats. See our contributor guide for more information about how you can get involved as a developer. If you are looking for something to start with, here is a beginner friendly list.

Financial Contributors

Become a financial contributor and help us sustain our community. Donations directly support office hours for maintainers, better documentation and strategic initiatives.

Platinum Sponsors

Platinum sponsorship starts at $950 USD/month.
Platinum Sponsors appear here at https://typelevel.org/cats

Gold Sponsors

Gold Sponsorship starts at $420 USD/month.
Gold Sponsors appear here at https://typelevel.org/cats

Silver Sponsors

Silver Sponsorship starts at $180 USD/month.
Silver Sponsors appear here at https://typelevel.org/cats

Backers

Become a Backer with a recurring donation of just $5 USD/month.
Backers appear here at https://typelevel.org/cats

Other contributors

We thankfully accept one-time and recurring contributions as well.
Other contributors appear here at https://typelevel.org/cats
<script src="/cats/js/sponsors.js"></script>

Getting Started

Cats is available for Scala.js and Scala Native, as well as the standard JVM runtime.

Cats relies on improved type inference via the fix for SI-2712, which is not enabled by default. For Scala 2.12 you should add the following to your build.sbt:

scalacOptions += "-Ypartial-unification"

(Partial unification is on by default since Scala 2.13, the compiler no longer accepts -Ypartial-unification)

And then create the Cats dependency, by adding the following to your build.sbt:

libraryDependencies += "org.typelevel" %% "cats-core" % "2.9.0"

This will pull in the cats-core module. If you require some other functionality, you can pick-and-choose from amongst these modules (used in place of "cats-core"):

  • cats-kernel: Small set of basic type classes (required).
  • cats-core: Most core type classes and functionality (required).
  • cats-laws: Laws for testing type class instances.
  • cats-free: Free structures such as the free monad, and supporting type classes.
  • cats-testkit: lib for writing tests for type class instances using laws.
  • algebra: Type classes to represent algebraic structures.
  • alleycats-core: Cats instances and classes which are not lawful.

There are several other Cats modules that are in separate repos so that they can maintain independent release cycles.

  • cats-effect: standard IO type together with Sync, Async and Effect type classes
  • cats-mtl: transformer typeclasses for Cats' Monads, Applicatives and Functors.
  • mouse: a small companion to Cats that provides convenient syntax (aka extension methods)
  • kittens: automatic type class instance derivation for Cats and generic utility functions
  • cats-tagless: Utilities for tagless final encoded algebras
  • cats-collections: Data structures which facilitate pure functional programming
  • cats-testkit-scalatest: Cats testkit integration with Scalatest

Past release notes for Cats are available in CHANGES.md.

Documentation

Links:

  1. Website: typelevel.org/cats/
  2. ScalaDoc: typelevel.org/cats/api/
  3. Type classes: typelevel.org/cats/typeclasses.html
  4. Data types: typelevel.org/cats/datatypes.html
  5. Algebra overview: typelevel.org/cats/algebra.html
  6. Glossary: typelevel.org/cats/nomenclature.html
  7. Resources for Learners: typelevel.org/cats/resources_for_learners.html
  8. FAQ: typelevel.org/cats/faq.html
  9. The Typelevel Ecosystem: typelevel.org/cats/typelevelEcosystem.html

Community

Discussion around Cats is currently happening on GitHub issues, PR pages, and Discord:

The Typelevel Discord has #cats and #cats-dev channels, as well as community channels such as #beginners. Please join us!

People are expected to follow the Scala Code of Conduct when discussing Cats on GitHub, Discord, or other venues.

We hope that our community will be respectful, helpful, and kind. If you find yourself embroiled in a situation that becomes heated, or that fails to live up to our expectations, you should disengage and contact one of the project maintainers in private. We hope to avoid letting minor aggressions and misunderstandings escalate into larger problems.

If you are being harassed, please contact one of us immediately so that we can support you.

Binary compatibility and versioning

After 1.0.0 release, we decided to use MAJOR.MINOR.PATCH Semantic Versioning 2.0.0 going forward, which is different from the EPOCH.MAJOR.MINOR scheme common among Java and Scala libraries (including the Scala lang).

Cats strives to provide a solid and stable foundation for an ecosystem of FP libraries. Thus, we treat backward binary compatibility maintenance with a high priority. In semantic versioning, backward breaking change is ONLY allowed between MAJOR versions. We will maintain backward binary compatibility between PATCH AND MINOR versions. For example, when we release Cats 1.1.0, it will be backward binary compatible with the previous 1.0.x versions. I.E. the new JAR will be a drop-in replacement for the old one. This is critical when your application has a diamond dependency on Cats - depending on two or more libraries that all depend on Cats. If one library upgrades to the new 1.1.0 Cats before the other one does, your application still runs thanks to this backward binary compatibility.

Also worth noting is that according to semantic versioning, MINOR version Y (x.Y.z | x > 0) MUST be incremented if new, backwards compatible functionality is introduced to the public API. It MUST be incremented if any public API functionality is marked as deprecated.

Any binary breaking changes will require a MAJOR version bump, which we will be very cautious about. We will also consider using organization and package name for major versioning in the future. But that decision is yet to be made.

Adopters

A (non-exhaustive) list of companies that use Cats in production is featured in ADOPTERS.md. Don't see yours? You can add it in a PR! And if you can, consider supporting us.

Maintainers

The current maintainers (people who can merge pull requests) are:

Retired committers include:

We are currently following a practice of requiring at least two sign-offs to merge code PRs (and for large or contentious issues we may wait for more). For typos, documentation improvements or minor build fix we relax this to a single sign-off. More detail in the process document.

Copyright and License

All code is available to you under the MIT license, available at http://opensource.org/licenses/mit-license.php and also in the COPYING file. The design is informed by many other projects, in particular Scalaz.

Copyright the maintainers, 2015-2023.

More Repositories

1

fs2

Compositional, streaming I/O library for Scala
Scala
2,319
star
2

scalacheck

Property-based testing for Scala
Scala
1,908
star
3

cats-effect

The pure asynchronous runtime for Scala
Scala
1,817
star
4

spire

Powerful new number types and numeric abstractions for Scala.
Scala
1,753
star
5

skunk

A data access library for Scala + Postgres.
Scala
1,545
star
6

simulacrum

First class syntax support for type classes in Scala
Scala
940
star
7

squants

The Scala API for Quantities, Units of Measure and Dimensional Analysis
Scala
910
star
8

kind-projector

Compiler plugin for making type lambdas (type projections) easier to write
Scala
906
star
9

frameless

Expressive types for Spark.
Scala
869
star
10

cats-collections

Data structures for pure functional programming in Scala
Scala
557
star
11

kittens

Automatic type class derivation for Cats
Scala
522
star
12

jawn

Jawn is for parsing jay-sawn (JSON)
Scala
431
star
13

log4cats

Logging Tools For Interaction with cats-effect
Scala
390
star
14

Laika

Site and E-book Generator and Customizable Text Markup Transformer for sbt, Scala and Scala.js
Scala
387
star
15

algebra

Experimental project to lay out basic algebra type classes
Scala
379
star
16

mouse

A small companion to cats
Scala
347
star
17

sbt-tpolecat

scalac options for the enlightened
Scala
328
star
18

discipline

Flexible law checking for Scala
Scala
322
star
19

natchez

functional tracing for cats
Scala
317
star
20

cats-mtl

cats transformer type classes.
Scala
304
star
21

cats-tagless

Library of utilities for tagless final encoded algebras
Scala
301
star
22

CT_from_Programmers.scala

Scala sample code for Bartosz Milewski's CT for Programmers
Scala
279
star
23

fs2-grpc

gRPC implementation for FS2/cats-effect
Scala
258
star
24

cats-parse

A parsing library for the cats ecosystem
Scala
224
star
25

machinist

Spire's macros for zero-cost operator enrichment
Scala
191
star
26

cats-effect-testing

Integration between cats-effect and test frameworks
Scala
184
star
27

paiges

an implementation of Wadler's a prettier printer
Scala
183
star
28

shapeless-3

Generic programming for Scala
Scala
168
star
29

grackle

Grackle: Functional GraphQL for the Typelevel stack
Scala
163
star
30

sbt-typelevel

Let sbt work for you.
Scala
151
star
31

feral

Feral cats are homeless, feral functions are serverless
Scala
144
star
32

munit-cats-effect

Integration library for MUnit & cats-effect
Scala
142
star
33

catbird

Birds and cats together
Scala
140
star
34

otel4s

An OpenTelemetry library for Scala based on Cats-Effect
Scala
138
star
35

fs2-chat

Sample project demonstrating use of fs2-io to build a chat client and server
Scala
123
star
36

spotted-leopards

Proof of concept for a cats-like library built using Dotty features
Scala
112
star
37

fabric

Object-Notation Abstraction for JSON, binary, HOCON, etc.
Scala
110
star
38

literally

Compile time validation of literal values built from strings
Scala
102
star
39

toolkit

Quickstart your next app with the Typelevel Toolkit!
Scala
92
star
40

cats-time

Cats Instances for Java Time
Scala
91
star
41

typelevel-nix

Development tools for Typelevel projects
Nix
87
star
42

vault

Type-safe, persistent storage for values of arbitrary types
Scala
81
star
43

shapeless-contrib

Interoperability libraries for Shapeless
Scala
79
star
44

cats-effect-cps

An incubator project for async/await syntax support for Cats Effect
Scala
78
star
45

scalacheck-effect

Effectful property testing built on ScalaCheck
Scala
76
star
46

coop

Cooperative multithreading as a pure monad transformer
Scala
68
star
47

claimant

Library to support automatic labeling of ScalaCheck properties.
Scala
68
star
48

typeclassic

Everything you need to make type classes first class.
Scala
61
star
49

scalaz-contrib

Interoperability libraries & additional data structures and instances for Scalaz
Scala
55
star
50

twiddles

Micro-library for building effectful protocols
Scala
55
star
51

monoids

Generic Monoids for Scala
Scala
51
star
52

fs2-netty

What it says on the tin!
Scala
47
star
53

sbt-catalysts

sbt utilities for open source projects
Scala
45
star
54

natchez-http4s

Glorious integration layer for Natchez and Http4s.
Scala
44
star
55

typelevel.github.com

Web site of typelevel.scala
HTML
38
star
56

jawn-fs2

Integration between jawn and fs2
Scala
36
star
57

keypool

A Keyed Pool Implementation for Scala
Scala
34
star
58

scalaz-specs2

Specs2 bindings for Scalaz
Scala
34
star
59

catalysts

Scala
34
star
60

case-insensitive

A case-insensitive string for Scala
Scala
34
star
61

simulacrum-scalafix

Simulacrum as Scalafix rules
Scala
33
star
62

scalaz-outlaws

outcasts no longer allowed in the ivory tower
Scala
28
star
63

scalac-options

A library for configuring scalac options
Scala
27
star
64

bobcats

Typelevel's very own CryptoKitties!
Scala
27
star
65

ce3.g8

Scala
24
star
66

scalaz-scalatest

Scalatest bindings for scalaz.
Scala
23
star
67

general

Repository for general Typelevel information, activity and issues
19
star
68

discipline-munit

MUnit binding for Typelevel Discipline
Scala
18
star
69

unique

Unique Functional Values for Scala
Scala
18
star
70

cats-testkit-scalatest

Cats Testkit for Scalatest
Scala
18
star
71

discipline-scalatest

ScalaTest binding for Discipline
Scala
17
star
72

typelevel-scalafix

Scalafix rules for Typelevel projects
Scala
17
star
73

semigroups

Scala
16
star
74

cats-effect-shell

Command line debugging console for Cats Effect
Scala
15
star
75

jdk-index

A Jabba compatible index of JDK versions
Scala
14
star
76

cats-uri

URI implementation based on cats-parse with cats instances
Scala
14
star
77

typelevel.g8

A typelevel.g8 based on sbt-typelevel
Scala
14
star
78

catapult

Scala
13
star
79

weaver-test

A test framework that runs everything in parallel.
Scala
11
star
80

discipline-specs2

Specs2 Integration for Discipline
Scala
8
star
81

governance

Typelevel governance
Scala
7
star
82

catz-cradle

Testbed for scala libraries and tools, based on examples from cats docs
Scala
7
star
83

spire-contrib

Interoperability libraries for spire
Shell
7
star
84

idna4s

Cross-platform Scala implementation of Internationalized Domain Names in Applications
Scala
6
star
85

scalac-compat

Lightweight tools for tackling Scalac version incompatibilities
Scala
6
star
86

steward

Runs Scala Steward for Typelevel projects
5
star
87

cats-effect-main

3
star
88

sacagawea

Common infrastructure for tracing functional effects
Scala
3
star
89

scalacheck-xml

Scalacheck instances for scala-xml
Scala
3
star
90

sorcery

WIP
2
star
91

scalacheck-web

ScalaCheck Web Site
Nix
2
star
92

sbt-catalysts.g8

Scala
2
star
93

feral.g8

Giter8 template for feral serverless
Scala
2
star
94

download-java

2
star
95

toolkit.g8

A Giter8 template for Typelevel Toolkit!
Scala
2
star
96

sbt-tls-crossproject

sbt-crossproject plugin for Typelevel Scala
Scala
1
star
97

catalysts-docker

Shell
1
star
98

await-cirrus

Depend on Cirrus CI from a GitHub Actions workflow
JavaScript
1
star
99

.github

a ✨special ✨ repository for project defaults and organization readme
1
star