News for hackers. Stuff that matters.
Re:Are Monads a Waste of Time? by proc0 on Tuesday February 20, 2018 @01:12PM (#16422452)
Pure FP is just using math as its primary source of programming patterns and techniques, while most other languages, like OOP, use arbitrary conventions to abstract code. Because mutation gives you tremendous flexibility, you can model many kinds of patterns, give it some analogy like inheritance in animals, and then write a language that has it out of the box. Haskell on the other is using math to construct its patterns, so while the learning curve is higher, eventually you realize this is the ultimate abstraction (category theory), and it cannot go more abstract than that. This is useful in some scenarios requiring more logical rigor, but I agree it's not always the best tool.
Re:Are Monads a Waste of Time? by j2kun on Tuesday February 20, 2018 @01:20PM (#16422530)
> eventually you realize this is the ultimate abstraction (category theory), and it cannot go more abstract than that

This is exactly the kind of false sense of intellectual superiority to avoid. Mathematicians and category theorists don't talk like this. Even the parts of Haskell that have the flavor of category theory aren't really all that much like category theory.

Re:Are Monads a Waste of Time? by proc0 on Tuesday February 20, 2018 @02:18PM (#16423178)
Maybe you can expand on that, and/or show me something more abstract than category theory. Programming = abstracting information processing. Category theory = the mathematics of abstract functions (or morphisms a.k.a. changing something)... so it makes sense that CT captures something very fundamental about computation.
Re:Are Monads a Waste of Time? by j2kun on Wednesday February 21, 2018 @02:36PM (#16432260)
1. Just because we have not thought of something more abstract does not mean category theory is the "ultimate" abstraction that cannot be surpassed. You would have said the same thing about sets before category theory was invented. 100% guaranteed there will be another, more abstract paradigm when the need arises.

2. Just because one thing captures something fundamental about computation does not mean it captures everything fundamental about computation, nor does it mean nothing else can capture fundamental aspects of computation (disjoint from what may or may not be captured by category theory). For example, category theory does a terrible job representing the mathematical subfield of complexity theory, despite it being entirely about computation. For that matter, "how abstract" is not always comparable, and the intellectual dick measuring of what is the most abstract is counterproductive. Even basic questions in particle physics have no known model in mathematics that doesn't break under gentle prodding, so is particle physics more abstract than mathematics?

3. Haskell does a lousy job representing the majority of ideas that make category theory useful to mathematicians. For example, universal properties are neglected Haskell, and at best they're implicit. Nobody actually thinks about the math when they're writing Haskell programs, they just think about Haskell types and programs, which makes the "techniques and patterns" of Haskell programming just as arbitrary as the conventions in random Javascript libraries. It's just that there are fewer names for the same thing because fewer people write serious programs in Haskell.

Re:Are Monads a Waste of Time? by dsacco on Wednesday February 21, 2018 @04:56PM (#16433341)
> Haskell does a lousy job representing the majority of ideas that make category theory useful to mathematicians. For example, universal properties are neglected Haskell, and at best they're implicit. Nobody actually thinks about the math when they're writing Haskell programs, they just think about Haskell types and programs, which makes the "techniques and patterns" of Haskell programming just as arbitrary as the conventions in random Javascript libraries. It's just that there are fewer names for the same thing because fewer people write serious programs in Haskell.

That’s an excellent point. So many people think they’re doing category theory when they’re writing Haskell, but Haskell is essentially nothing like the mathematics it borrows terminology from. They’re really not comparable. Which is absolutely fine, but then people shouldn’t draw parallels to the actual mathematics when the terminology is similar in name only.

Re:Are Monads a Waste of Time? by Koshkin on Tuesday February 20, 2018 @02:54PM (#16423573)
Technically, category theory is not more abstract than the rest of (abstract) algebra.
Re:Are Monads a Waste of Time? by proc0 on Tuesday February 20, 2018 @03:46PM (#16424036)
You can derive all other math branches with CT, so yes, it is more abstract. It is "higher level" (in the same sense of programming languages) than other maths.
Re:Are Monads a Waste of Time? by fyi1183 on Tuesday February 20, 2018 @04:32PM (#16424396)
Please point out where somebody genuinely puts an effort to found math on category theory? The standard way to do so is set theory, and the more recent hype is type theory.

Category theory in itself is pretty useless. Categories are a bit like graphs in that: they are too general.

There are serious mathematical theories using category theory as their language (mostly commutative algebra and whatever it touches) just as there are serious theories using the language of graphs, but in both cases the meat of the math is not in the underlying language.

Re:Are Monads a Waste of Time? by mbid on Tuesday February 20, 2018 @06:09PM (#16425162)
There are serious efforts to found maths on elementary toposes, which are categories with certain properties. Much the same way that the axioms of ZFC model the properties of sets in terms of the "is element" relation, you can give first order axioms for how the morphisms and objects of an elementary topos behave. Then you may add more axioms to assert that the elementary topos you're talking about is really a category of sets in the sense of ZFC.

If you want to research more about this, I can recommend sheaves in geometry and logic by Maclane and Moerdijk. You can also search for "algebraic set theory" and go from there.

And btw, type theory is essentially the same thing. The axioms are IMO uglier and more ad-hoc, but there are (some proven, some conjectured) equivalence results.

Re:Are Monads a Waste of Time? by infty on Wednesday February 21, 2018 @09:06AM (#16429493)
>Please point out where somebody genuinely puts an effort to found math on category theory?

What about the following: https://ncatlab.org/nlab/show/foundation+of+mathematics#CFM

Even if the meat of the math is not in the categorical aspects of a theory, the categorical input can be useful - if nothing else, then as a convenient language.

Re:Are Monads a Waste of Time? by scentoni on Wednesday February 21, 2018 @01:25AM (#16427313)
Re:Are Monads a Waste of Time? by lmm on Wednesday February 21, 2018 @04:36AM (#16428154)
That is a) a great project b) not category theory.
Re:Are Monads a Waste of Time? by dsacco on Tuesday February 20, 2018 @06:12PM (#16425189)
No, you can’t. The vast majority of analysis cannot usefully be represented in category theory. You can’t express everything in analysis using morphisms and maps.

When you’re working with structures (algebra, geometry, topology, etc), sure, you can construct them in the language of categories. But that’s very far from “all of math”.

Re:Are Monads a Waste of Time? by FridgeSeal on Tuesday February 20, 2018 @07:38PM (#16425750)
CT exists at the same level as some other "fundamental level" fields of maths like topology and abstract algebra (/algerbraic topology).

It's certainly very abstract and fundamental, but it's definitely not the root field.

Re:Are Monads a Waste of Time? by madmax96 on Wednesday February 21, 2018 @01:41PM (#16431793)
You can't derive CT with CT. Though that has nothing to do with your point, just suggesting that we aren't there yet.
Re:Are Monads a Waste of Time? by Retra on Tuesday February 20, 2018 @07:09PM (#16425591)
You can derive all other math from any Turing complete system. Category theory is no more powerful than that.
Re:Are Monads a Waste of Time? by tathougies on Tuesday February 20, 2018 @07:46PM (#16425795)
Given that turing complete systems are not total, you can actually derive anything, including falsehood, from them. The point being that a general 'turing complete' system is about as useful to use as the basis of mathematics as a banana.

Category theory is not a great basis for mathematics, but at least it's not inconsistent.

Re:Are Monads a Waste of Time? by Eire_Banshee on Tuesday February 20, 2018 @03:32PM (#16423910)
You are missing his entire point.
Re:Are Monads a Waste of Time? by proc0 on Tuesday February 20, 2018 @03:45PM (#16424026)
I know, which is why I asked for some clarification. I actually think haskell is able to directly implement CT, there is HASK category after all. If it's that this is too pretentious to even mention in HN, then I'm completely lost.
Re:Are Monads a Waste of Time? by dragonwriter on Tuesday February 20, 2018 @04:07PM (#16424211)
> there is HASK category after all.

This is disputed and seems to be at best conjecture/intuition without adequate formal definition supporting it.

Re:Are Monads a Waste of Time? by jonnybgood on Tuesday February 20, 2018 @04:03PM (#16424179)
Hask is not a real category.
Re:Are Monads a Waste of Time? by runT1ME on Tuesday February 20, 2018 @04:42PM (#16424483)
>Even the parts of Haskell that have the flavor of category theory aren't really all that much like category theory.

Can you expound on this? Just because the type classes defined in Haskell can't represent a wider range of categorical structures they purport to capture, does not mean that more structure doesn't exist throughout a Haskell code base. For instance, many argue that the only type of functors used in Haskell are endofunctors, but thats not really true unless we have a narrow definition of 'functors used in haskell', no?

Re:Are Monads a Waste of Time? by tome on Tuesday February 20, 2018 @04:44PM (#16424497)
The typeclass Functor represents endofunctors from * to *. That's a pretty limited notion of "functor" when considered mathematically but also extremely useful for programming!
Re:Are Monads a Waste of Time? by zby on Tuesday February 20, 2018 @03:36PM (#16423946)
"Because mutation gives you tremendous flexibility ... Haskell on the other is using math to construct its patterns" - so mutation is somehow outside of math?
Re:Are Monads a Waste of Time? by smadge on Wednesday February 21, 2018 @12:10PM (#16430971)
x = 0 and x = 1. Therefore by the reflexive and transitive property of equality, 0 = 1.
Re:Are Monads a Waste of Time? by zby on Saturday February 24, 2018 @02:55AM (#16452257)
OK - it uses different notation where '=' is not the same as in maths. But that is kind of trivial. There are perfectly mathematical semantics of both functional and imperative languages.
Re:Are Monads a Waste of Time? by kqr on Wednesday February 21, 2018 @01:30AM (#16427333)
> Because mutation gives you tremendous flexibility,

Interesting how perspective works. I frequently think of mutation as a really annoying restriction. In the presence of mutation, I can no longer assume things are what they say they are -- for they mave have changed between when I looked at them and when I speak of them.

That is fine, if you have a way of separating state from identity, and a way of synchronising the two when it makes sense to do so. Unfortunately, languages with uncontrolled mutation lack both.

Re:Are Monads a Waste of Time? by jonnybgood on Tuesday February 20, 2018 @03:04PM (#16423665)
> ultimate abstraction (category theory), and it cannot go more abstract than that.

I’m curious. What makes you think that?

Re:Are Monads a Waste of Time? by proc0 on Tuesday February 20, 2018 @04:23PM (#16424328)
Because you cannot discard more detail than what CT has chosen to discard. You start with objects and arrows, and how the arrows compose. Every object has an identity which is another arrow, so in some sense you have just a composition of arrows, and that's it. CT starts really simple, and I don't think there's anything left to hide or abstract.
Re:Are Monads a Waste of Time? by mbid on Tuesday February 20, 2018 @06:17PM (#16425221)
Every category is an infinity category, but the converse is not true. Thus, infinity categories are more general than categories.

But you don't have to go that far: Just remove e.g. identity morphisms from categories, and you get something that is more general than categories.

It is of course another matter completely whether these structures are a useful abstraction for what you want to accomplish. I've never come across something reasonable that has arrows and associative composition, but no identities. As for infinity categories, I remain very skeptical that they abstract any problems programmers not concerned with topology (i.e. > 99%) have.

So yeah, categories are a reasonable baseline from where you can build. But you can't show anything relevant and non-trivial that holds in any category. You'll need more structure, hence less generality, for that.

Re:Are Monads a Waste of Time? by Koshkin on Tuesday February 20, 2018 @05:06PM (#16424683)
You may be wrong here, there have been some discussions - see for example https://www.quora.com/Whats-more-general-than-category-theor...
Re:Are Monads a Waste of Time? by leshow on Tuesday February 20, 2018 @04:13PM (#16424262)
Not the other poster, but CT is the language of composition and abstraction, it's the high level language of math.

I think people are just butt-hurt that he used the word 'ultimate'.

Re:Are Monads a Waste of Time? by dsacco on Tuesday February 20, 2018 @06:21PM (#16425249)
Category theory is not “the high level language of math”. You cannot universally apply category theory to all other fields of mathematics.
Re:Are Monads a Waste of Time? by leshow on Wednesday February 21, 2018 @01:59PM (#16431936)
What fields of math do you think it doesn't apply to?
Re:Are Monads a Waste of Time? by dsacco on Wednesday February 21, 2018 @02:19PM (#16432097)
Analysis.
Re:Are Monads a Waste of Time? by taktoa on Wednesday February 21, 2018 @06:37PM (#16433950)
Re:Are Monads a Waste of Time? by dsacco on Wednesday February 21, 2018 @07:33PM (#16434237)
You cannot build all of analysis from category theory. Categories, morphisms and functors are not nuanced enough to encapsulate everything in analysis. The question was not, “Can you restate some results in category theory”, the question was “what cannot category theory build?”

What you’re linking to is part of a relatively small corpus outside of e.g. algebraic geometry and topology that has successfully been used for nontrivial results. And as another commenter said, while it can be used for e.g. computation, it is extremely poor for complexity theory. There is a reason why basically any analyst (as opposed to algebraic geometer) will use set theory instead of categories for their work.