HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Request an account if you don't have one.

Category theory

Categories: Theoretical foundations | Mathematics

Haskell theoretical foundations

General:
Mathematics - Category theory
Research - Curry/Howard/Lambek

Lambda calculus:
Alpha conversion - Beta reduction
Eta conversion - Lambda abstraction

Other:
Recursion - Combinatory logic
Chaitin's construction - Turing machine
Relational algebra

Category theory can be helpful in understanding Haskell's type system. There exists a "Haskell category", of which the objects are Haskell types, and the morphisms from types a to b are Haskell functions of type a -> b. Various other Haskell structures can be used to make it a Cartesian closed category.

Contents


The Haskell wikibooks has an introduction to Category theory, written specifically with Haskell programmers in mind.

1 Definition of a category


A category \mathcal{C}consists of two collections:

Ob(\mathcal{C}), the objects of \mathcal{C}

Ar(\mathcal{C}), the arrows of \mathcal{C} (which are not the same as Arrows defined in GHC)

Each arrow f in Ar(\mathcal{C}) has a domain, dom f, and a codomain, cod f, each chosen from Ob(\mathcal{C}). The notation f\colon A \to B means f is an arrow with domain A and codomain B. Further, there is a function \circ called composition, such that g \circ f is defined only when the codomain of f is the domain of g, and in this case, g \circ f has the domain of f and the codomain of g.

In symbols, if f\colon A \to B and g\colon B \to C, then g \circ f \colon A \to C.

Also, for each object A, there is an arrow \mathrm{id}_A\colon A \to A, (often simply denoted as 1 or id, when there is no chance of confusion).

1.1 Axioms

The following axioms must hold for \mathcal{C} to be a category:

  1. If f\colon A \to B then f \circ \mathrm{id}_A = \mathrm{id}_B\circ f = f (left and right identity)
  2. If f\colon A \to B and g \colon B \to C and h \colon C \to D, then h \circ (g \circ f) = (h \circ g) \circ f (associativity)

1.2 Examples of categories

1.3 Further definitions

With examples in Haskell at:

2 Categorical programming

Catamorphisms and related concepts, categorical approach to functional programming, categorical programming. Many materials cited here refer to category theory, so as an introduction to this discipline see the #See also section.

3 Haskell libraries and tools

4 Books

5 See also

Retrieved from "http://haskell.cs.yale.edu/haskellwiki/Category_theory"

This page has been accessed 14,136 times. This page was last modified 10:29, 16 January 2009. Recent content is available under a simple permissive license.