News for hackers. Stuff that matters.
Re:Graphical Linear Algebra by siraben on Tuesday August 18, 2020 @06:35AM (#24197117)
> But it is possible I am just not imaginative enough. Do you have a concrete example of this?

Well, in the case of functor it's not terribly interesting, but here's an example. A functor F has the property F g . F h = F (g . h), so this means that if you were writing

  map f (map g l)
you could write

  map (f . g) l
instead, (in Haskell the compiler optimizes it anyway) but if your compiler actually traversed the list twice, now it traverses the list once.

I could list other things like how monoids, monads, etc. can help make programs more efficient (monoids allow exponentiation with squaring) or structure programs better (monads allow composition of partial/stateful/exceptional functions).

Re:Graphical Linear Algebra by ogogmad on Tuesday August 18, 2020 @06:55AM (#24197225)
Your example for the application of the "functor" concept is trivial enough that it doesn't need category theory.

Monoids are very simple objects, and you don't need to use category theory to define them.

Monads might be a more meaty example. But I'm not sure if knowing CT makes it easier to use monads in a programming context.

Re:Graphical Linear Algebra by siraben on Tuesday August 18, 2020 @07:06AM (#24197292)
They're trivial constructions yes. But the difference is the shift in vocabulary, instead of understanding functor fusion in an ad-hoc way, the concept can be made more precise, also it can lead you to find other "non-trivial" functors for instance the Hom(a,-) covariant functor or the Hom(-,a), but equipped with the right vocabulary these things are easy to express.

Sure, monoids are trivial, because they are, but once you're in the categorical setting you can begin to talk about the category of monoids, monoid homomorphisms and so on.

This isn't to say that CT is the answer, but I'm pointing out that it provides a way to understand more complicated concepts.

Functors are trivial, but if you take their fixpoint you get ADTs. Monoids are trivial, but if you apply them to the category of endofunctor you derive monads, and so on.

Re:Graphical Linear Algebra by tome on Tuesday August 18, 2020 @01:25PM (#24201475)
> Your example for the application of the "functor" concept is trivial enough that it doesn't need category theory.

That's kind of the point.

> "Perhaps the purpose of categorical algebra is to show that which is trivial is trivially trivial." That is, category theory aids in making the softer bits of mathematics look utterly natural and obvious, so that one can more easily isolate the harder nuggets and attack them with abandon ... This is a tremendous service that category theory provides"

https://mathoverflow.net/questions/28788/nontrivial-theorems...

In isolation applications of category theory to programming are going to be trivial, typically. Category theory gives a language and framework for extracting trivialities so one can "attack the harder nuggets" without distraction.