Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Haskell
Wiki community
Recent changes
Random page
HaskellWiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Category theory
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Definition of a category== A category <math>\mathcal{C}</math>consists of two collections: Ob<math>(\mathcal{C})</math>, the objects of <math>\mathcal{C}</math> Ar<math>(\mathcal{C})</math>, the arrows of <math>\mathcal{C}</math> (which are not the same as [[Arrow]]s defined in [[GHC]]) Each arrow <math>f</math> in Ar<math>(\mathcal{C})</math> has a domain, dom <math>f</math>, and a codomain, cod <math>f</math>, each chosen from Ob<math>(\mathcal{C})</math>. The notation <math>f\colon A \to B</math> means <math>f</math> is an arrow with domain <math>A</math> and codomain <math>B</math>. Further, there is a function <math>\circ</math> called composition, such that <math>g \circ f</math> is defined only when the codomain of <math>f</math> is the domain of <math>g</math>, and in this case, <math>g \circ f</math> has the domain of <math>f</math> and the codomain of <math>g</math>. In symbols, if <math>f\colon A \to B</math> and <math>g\colon B \to C</math>, then <math>g \circ f \colon A \to C</math>. Also, for each object <math>A</math>, there is an arrow <math>\mathrm{id}_A\colon A \to A</math>, (often simply denoted as <math>1</math> or <math>\mathrm{id}</math>, when there is no chance of confusion). ===Axioms=== The following axioms must hold for <math>\mathcal{C}</math> to be a category: #If <math>f\colon A \to B</math> then <math>f \circ \mathrm{id}_A = \mathrm{id}_B\circ f = f</math> (left and right identity) #If <math>f\colon A \to B</math> and <math>g \colon B \to C</math> and <math>h \colon C \to D</math>, then <math>h \circ (g \circ f) = (h \circ g) \circ f</math> (associativity) ===Examples of categories=== * Set, the category of sets and set functions. * Mon, the category of monoids and monoid morphisms. * Monoids are themselves one-object categories. * Grp, the category of groups and group morphisms. * Rng, the category of rings and ring morphisms. * Grph, the category of graphs and graph morphisms. * Top, the category of topological spaces and continuous maps. * Preord, the category of preorders and order preserving maps. * CPO, the category of complete partial orders and continuous functions. * Cat, the category of categories and functors. * [[Hask]] * the category of data types and functions on data structures * the category of functions and data flows (~ data flow diagram) * the category of stateful objects and dependencies (~ object diagram) * the category of values and value constructors * the category of states and messages (~ state diagram) ===Further definitions=== With examples in Haskell at: * [[Category theory/Functor]] * [[Category theory/Natural transformation]] * [[Category theory/Monads]]
Summary:
Please note that all contributions to HaskellWiki are considered to be released under simple permissive license (see
HaskellWiki:Copyrights
for details). If you don't want your writing to be edited mercilessly and redistributed at will, then don't submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
DO NOT SUBMIT COPYRIGHTED WORK WITHOUT PERMISSION!
Cancel
Editing help
(opens in new window)
Toggle limited content width