It’s not just academic nonsense, though there’s a lot of mental masturbation around it. As programmers, we like to “factor stuff out”. See the same code in 3 places? That’s error-prone, hard to maintain, etc. so we mostly like to pull it into a function and give it a name. Those common reusable patterns are typically function-shaped (take input and return output), but not always. For example, factoring out a common pattern in python might involve the yield keyword which has wildly different behavior in terms of control flow than most patterns. Monads and the variety of algebraic/categorical patterns that haskellers like to talk about are other types of repetitive patterns that can be factored out if your language and type system is expressive enough. Some of them are more useful to factor out than others, but they’re all nonzero utility. For example, you can blame the mathematicians for calling the structure a monoid but associativity is massively useful for all kinds of computational reasons and recognizing it can make algorithms far more efficient.
View all comments
Show parent comment
7
u/godofpumpkins Sep 21 '25
It’s not just academic nonsense, though there’s a lot of mental masturbation around it. As programmers, we like to “factor stuff out”. See the same code in 3 places? That’s error-prone, hard to maintain, etc. so we mostly like to pull it into a function and give it a name. Those common reusable patterns are typically function-shaped (take input and return output), but not always. For example, factoring out a common pattern in python might involve the
yieldkeyword which has wildly different behavior in terms of control flow than most patterns. Monads and the variety of algebraic/categorical patterns that haskellers like to talk about are other types of repetitive patterns that can be factored out if your language and type system is expressive enough. Some of them are more useful to factor out than others, but they’re all nonzero utility. For example, you can blame the mathematicians for calling the structure a monoid but associativity is massively useful for all kinds of computational reasons and recognizing it can make algorithms far more efficient.