A typeclass is a specification for one behavior associated with a single type. This behavior is checked by a test suite called the “laws” for that typeclass. These test suites are available in the package arrow-tests.

What differentiates typeclasses from regular OOP inheritance is that typeclasses are meant to be implemented outside of their types. The association is done using generic parametrization rather than the usual subclassing by implementing the interface. This means that they can be implemented for any class, even those not in the current project, and allows us to make available at the global scope any one implementation of a typeclasses for the single unique type they’re associated with.


You can read all about how Arrow does typeclasses in the glossary.

Typeclasses in Arrow

We will list all the typeclasses available in arrow by the module they belong to, and a short description of the behavior they abstract.


The package typeclasses contains all the typeclass definitions that are general enough not to be part of a specialized package. We will list them by their hierarchy.

  • Inject - transformation between datatypes

  • Alternative - has an structure that contains either of two values

  • Show - literal representation of an object
  • Eq - structural equality between two objects

  • Order - determine whether one object precedes another

  • Semigroup - can combine two objects together

  • SemigroupK - can combine two datatypes together

  • Monoid - combinable objects have an empty value

  • MonoidK - datatypes have an empty value

  • Foldable - has a structure from which a value can be computed from visiting each element

  • Bifoldable - same as foldable, but for structures with more than one possible type, like either

  • Reducible - structures that can be combined to a summary value

  • Traverse - has a structure for which each element can be visited and get applied an effect


Effects provides a hierarchy of typeclasses for lazy and asynchronous execution.

  • MonadSuspend - can evaluate functions lazily

  • Async - can be created using an asynchronous callback function

  • Effect - can extract a value from an asynchronous function


The Monad Template Library module gives more specialized version of existing typeclasses


  • At - provides a Lens for a structure with an indexable focus.

  • FilterIndex - provides a Traversal for a structure with indexable foci that satisfy a predicate.

  • Index - provides an Optional for a structure with an indexable optional focus.

  • Each - provides a Traversal.


  • Corecursive - traverses a structure forwards from the starting case

  • Recursive - traverses a structure backwards from the base case

  • Birecursive - it is both recursive and corecursive