News for hackers. Stuff that matters.
Re:Category theory for beginners by losvedir on Tuesday February 24, 2015 @10:07AM (#9100899)
These slides do the same misleading thing all the other slides I've looked at do: show examples where there are only an arrow or two between objects. I still don't really understand category theory, but one breakthrough I had was when I realized that two objects can (and often do) have LOTS (or even infinite) arrow between them.

For example, in a category of "types", each object could be a type (e.g.: int, float, list(int), etc.), and each arrow could be a function between those types.

With that example, just think of all the arrows between, say, string -> int! There's "length()", "md5()", "to_i()", etc. And don't even get me started on the "identity" arrows of string back to itself (upcase, downcase, strip, etc). We're talking gazillions of arrows.

Re:Category theory for beginners by cheatsheet on Tuesday February 24, 2015 @10:27AM (#9101052)
I just sort of abstract over the specifics of the implementation of arrows and assume there is an arrow that denotes the 'kind' of arrow. Does it express a monotonic function (order preserving), does it express a non monotonic function (permutation of elements, ordering of computation of 'typical' threads).

It groups functional operations into kinds that you can make assertions about after a selection of the operations have been performed.

Haskell does -

add :: Integer -> Integer -> Integer

so the compiler can check all the branches of code to ensure that statement is invariant.

Re:Category theory for beginners by tfgg on Tuesday February 24, 2015 @10:13AM (#9100948)
So, on slide 33, the "+1" and "bestFriend" arrows are identities of Int and Person? On slide 35 it says that identity is associated with the identity function, but to me that means a function that returns what you give it, rather than "+1", which gives you the next number. So the identity of Person just means any function with the type signature Person->Person?
Re:Category theory for beginners by orbifold on Tuesday February 24, 2015 @10:25AM (#9101037)
No, the identity id:A->A is characterized by the property that for all arrows

f:B->A and g:A->C

(P1) id . f = f and (P2) g . id = g, in particular it is unique, since if id':A->A had the same property, then

id' = id . id' = id,

where the first equality follows by (P1) and the second by (P2').

Re:Category theory for beginners by tfgg on Tuesday February 24, 2015 @10:30AM (#9101074)
Ok, I think I got the wrong idea that the identity was any arrow pointing back on to an object. Thanks.
Re:Category theory for beginners by jackmaney on Tuesday February 24, 2015 @11:52AM (#9101799)
There's an old mathematical wive's tale about the professor who, on the beginning of the first day of an abstract algebra course, writes the following definition down on the board:

Definition: A group is a category with a single object, all of whose morphisms are both epic[1] and monic[2].

In particular, if you drop the epic and monic requirements, a category that has only one object can be viewed as a monoid[3] under morphism composition.

[1]: http://en.wikipedia.org/wiki/Epimorphism

[2]: http://en.wikipedia.org/wiki/Monomorphism

[3]: http://en.wikipedia.org/wiki/Monoid