
Category Theory, Syntactically (2016) - colinprince
http://www.hedonisticlearning.com/posts/category-theory-syntactically.html
======
stillkicking
I don't understand why anyone thinks step 1 in conveying any concept is
definitions. This is not how brains work. Definitions are how you formalize
your understanding once you've developed it. If this is meant to be an
introduction, it's entirely backwards.

Also, if your examples are made only of the thing you're trying to explain,
they're not examples.

~~~
stillkicking
Introduction to Cake Making

A cake is a baked good containing one or more edible substances, created by a
baker. Cakes are made in a kitchen, using appliances, implements and utensils.
An appliance is a powered mechanical device used to augment the baker's
abilities, different from an implement and a utensil. Implements and utensils
are unpowered tools used by hand to produce batter from ingredients. A batter
is a mixture produced in stages, consisting of a base starch, proteins and
flavoring agents.

For a concrete example of a cake, consider a cake containing one or more
fruits. The fruit may be uniformly distributed among the cake's contents or
clustered in toppings. This produces the cake's characteristic flavor and
color, though color may also result from artificial coloring agents.

Through prolongued exposure to heat, we can transform batter into a cake.
Molds may be used for this. Any bowls, spoons or whisks used in the process
may contain residual batter suitable for direct consumption. [1]

In some ways I've stopped just when things were about to get good, but now you
should have a solid understanding of the fundamentals.

[1] Licking is actually quite natural in this context.

~~~
Xophmeister
More recipe books should be written by mathematicians ;)

~~~
1001101
Euginia Cheng, a category theorist, has written Cakes, Custard and Category
Theory: Easy Recipes for Understanding Complex Maths, and How to Bake Pi: An
Edible Exploration of the Mathematics of Mathematics.

~~~
seanmcdirmid
Fascinating!
[https://en.wikipedia.org/wiki/Eugenia_Cheng](https://en.wikipedia.org/wiki/Eugenia_Cheng)

She even appeared on the late show
([https://m.youtube.com/watch?v=mA402F5K47o](https://m.youtube.com/watch?v=mA402F5K47o)).

------
3131s
And... I still understand nothing about category theory.

Are there any more comprehensible primers out there or is this just a field of
mathematics that I shouldn't expect to understand without years of prior study
in other requisite fields? Or am I better off building something in Haskell
and learning by doing? I know some discrete math, but all attempts at
broaching category theory have been so far totally unsuccessful for me.

~~~
a-saleh
My understanding was made better when I started thinking about utilizing
category theory in programming, more in a way of "here are some design
patterns stolen from abstract algebra", rather than "man! now I should learn
this entire branch of mathematics".

The branch of math itself would be mostly useless anyway, because it is mostly
concerned about relations between categories, and as programmers, you usually
work just within a single category, category of functions and types in your
programming languages :-)

But from the practical, design-pattern viewpoint, I would suggest trying
purescript :-)

My journey was working through the purescript book [1] up to the Applicative
Validation chapter. And then I played around with the flare backend in try-
purescript [2]. And then it clicked for me and I was suddenly able to read and
comprehend Typeclassopedia [3] :-)

[1] [https://leanpub.com/purescript/read](https://leanpub.com/purescript/read)
[2]
[http://try.purescript.org/?backend=flare&session=a06d83dd-d0...](http://try.purescript.org/?backend=flare&session=a06d83dd-d0a9-e686-4533-7f7ad9940e40)
[3]
[https://wiki.haskell.org/Typeclassopedia](https://wiki.haskell.org/Typeclassopedia)

~~~
alipang
I'd say there is not much point to Category Theory if we where to restrict
ourselves to a single category. For instance Monoids are categories (with a
single object) that is not the category of functions. Another set are the
Kleisli Categories[1] that are equivalent to monads.

You mention Applicative Functors, which form another (different) category
where arrows from a to b are on the form `f (a -> b)` and composition and
identity laws of these arrows are equivalent to the applicative laws.

[1]
[https://en.wikipedia.org/wiki/Kleisli_category](https://en.wikipedia.org/wiki/Kleisli_category)

~~~
a-saleh
I got my point about single category from a friend of mine that studied
category theory and applied it to problems topology.

Way he explained it, they often were searching for relations between
categories that didn't at all intersect.

And way I was learning the applications of category theory in i.e. haskel, I
viewed it more as learning about algebraic structures in the category of
haskel types and functions.

So right now I have reasonable idea about i.e. applicative functors in haskel.
But thinking about applicative functors as their own category is one
abstraction step above what I am usually used to :-)

------
vorotato
Learning Category theory should be as easy as A -> B -> C.

A is a category

A -> B is an arrow, often called a morphism, but we're not going to be all
highfalutin about this.

Think of A -> B like a function which takes type A, and returns type B. After
all, types can be seen as a specific kind of category, and functions can be
seen as a specific kind of arrow. It can be helpful to pretend say A is an
int, and B here is a string, maybe C is a float but really they can be any
type as long as they are not the same.

The rest of it is just stuff you already know. To qualify as a category it
must be associative aka (A -> B) -> C == A -> (B -> C) and it must be possible
to make arrows that don't change the category such as A -> A, B -> B and C ->
C. You can see how if f = A -> B; and g = B -> C we can compose f, and g to
make an arrow from A -> C.

Any time you have things (categories), and verbs (arrows) which meet
associativity, and identity (which is usually the verb of doing nothing) you
can do category theory to it.

~~~
eastWestMath
I think you mean that A is an object of your category...

~~~
harveywi
Unless the category is, e.g., the category of small categories.

~~~
vorotato
Yeah I thought I could get away with omitting a term but it's too specific and
really fails to catch how broad categories are.

------
stared
A simple (but potentially dangerous) question - is there any _practical_
application of category theory?

(I have PhD in quantum physics theory... yet, each time I see category theory,
it looks to me as abstract nonsense. The only example when it was for me
anyhow insightful is the abstract definition of tensor product; but for more
mundane stuff, all examples I know can be implemented with functions (or even:
matrices :)).)

~~~
mafribe
The prime purpose of CT is unification, showing that many familiar things are
instances of the same idea. In that sense CT is shallow, you can always in
principle do without CT what you can do with. But without the abstract view
afforded by CT, you may not see similarities.

Here are moderately practical things that came from CT.

\- CAML, the predecessor to OCaml had a virtual machine based on category
theory.

\- Monadic effect handling, which is an approach to modularising computation,
is based on category theory.

\- Remarkably, Bell's theorem from physics and database theory share a
surprising amount of structure, see [1].

\- Modern libraries like Scala's Scalaz.

[1] S. Abramsky, Relational Databases and Bells Theorem.

------
crb002
My talk at LambdaConf last year. Practical category theory refactoring couched
in the language of middle school Algebra.
[https://www.youtube.com/watch?v=Mhw4FD0pCU8](https://www.youtube.com/watch?v=Mhw4FD0pCU8)

We learned sums (a+b) and products (a*b) well. The leap is understanding that
exponents count function spaces a->b.

------
mijoharas
Can someone explain what the symbol that normally means "approximately equal"
(≈) means in the article?

~~~
jjaredsimpson
a≈b means (a,b) is in the equivalence relation ≈

