Is there any connection between category theory and the way computer languages work? by **Thorsten Altenkirch**

Yes, lots.

Just one example: a function with 2 inputs from A and B and results from C would have the type A x B -> C but in functional languages like Haskell we are using A -> (B -> C), i.e. a function that returns a function. This “**currying**” is exactly a the categorical definition of a cartesian closed category as one where **Hom(AxB,C)** is *isomorphic* to **Hom(A,B -> C)** and in this false you can replace Hom(X,Y) with X -> Y.

It is well known that effects in functional programming can be modelled by **monads** which is a concept from category theory. Nowadays a weaker structure called **applicative functors** has become very popular – needless to say also a concept from Category Theory.

Not all languages are functional (yet) but even non-functional languages can be understood using concepts from category theory.

See also:

Free Categories, Free Mono*I*ds, Monads = MonoId+Endofunctor

**Monad Diagram**

### Like this:

Like Loading...

*Related*

Reblogged this on Lisper.

Reblogged this on Singapore Maths Tuition.