[Haskell-cafe] Category Theory and Haskell

John Wiegley johnw at fpcomplete.com
Mon Nov 26 02:30:11 CET 2012

>>>>> Gytis Žilinskas <gytis.zilinskas at gmail.com> writes:

> How difficult would it be to study category theory and simultaneously come
> up with Haskell examples of various results that it presents?

There are some aspects of CT that you will not be able to express in Haskell
easily (try encoding the forgetful functor, for instance).  But there are
other things which translate quite nicely.  As one example, I've been using
Haskell to explore the connection between adjunctions and monads, and have
found it quite rewarding.  My efforts so far are here:


What I found most compelling from that code is I only need a minimal
definition of the Prod ⊣ Hom adjunction, (ε and η -- and their definitions are
trivial), I get all the behavior of the well-known State monad, whose typical
implementation via >>= is rather tricky.

Doing this exploration in Haskell -- with the aid of the type-checker -- made
certain connections clear that were difficult to see in the abstract.  And it
was plenty of fun besides. :)

Happy brain spelunking,
John Wiegley
FP Complete                         Haskell tools, training and consulting
http://fpcomplete.com               johnw on #haskell/irc.freenode.net

More information about the Haskell-Cafe mailing list