9 ms·
The Dao of Functional Programming [pdf]
- nh23423fefe 4y agoalso the classic category theory for programmers https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/ https://bartoszmilewski.com/2014/10/28/category-theory-for-p...
- helpfulmandrill 4y agoLooks neat. Is this complete, or a work in progress? Is there a blog article about it anywhere by the author?
- deleted 4y ago[deleted]
- throwaquestion5 4y agoI have read some of Dr. Milewski blog posts like Functorio[1]. He always reminds me I don't know FP as well as I think I do. Will use this to test, and learn again about it. Get it while is still hot (Last updated: May 21, 2022) [1] https://bartoszmilewski.com/2021/02/16/functorio/ https://bartoszmilewski.com/2021/02/16/functorio/
- bsedlm 4y agoI think it's time to elevate the function into the same status as the number. A number is ultimately founded on sets. A number is a most basic way to structure sets. Every number can be made out of pure sets (and later on, from tuples of sets-as-numbers) At the moment, functions are also founded in terms of sets. But I think that mathematics can be constructed based on functions instead of sets. As far as I understand, this can be done using simple type theory; but I still have some studying to do about STT. In any case, my point is that most mathematics since around the 18th century are not really working with numbers, but with functions as if they were numbers.
- carnitine 4y agoThis is what category theory attempts to do, except in an even more abstract sense, based on morphisms which generalise functions.
- layer8 4y agoWouldn’t relations be the more fundamental notion?
- bsedlm 4y agorelations are also defined in terms of sets: As a sets of pairs, e.g. an element of a set like {x ,{x,y}} is just the pair (x,y), a set of such pairs IS a relation. moreover, in terms of sets functions are a relation with some restrictions: - That they are binary relations - The "functional-requirement" (as I call it) refers to the difference between a relation and a function. for every x, f(x) = (only one thing); e.g. a relation can have pairs (x,a) and (x,b) but no function can do this. As far as I've understood, this gets really "fun" when characteristic-functions enter the scene... With these boolean-valued functions it's possible to define a set.
- adamnemecek 4y agoI have been thinking about adjointness, norm and fixed points a lot lately and it’s kind of insane how common it is https://github.com/adamnemecek/adjoint/ https://github.com/adamnemecek/adjoint/
- bradrn 4y agoDespite the name, I’ll note that this says far more about category theory than it does about FP. In fact, I’d argue that it’s not particularly closely related to FP at all — this should have been titled ‘The Dao of Type Systems’, or something along those lines. Certainly, the category-theoretic stuff is very interesting, and can even be quite useful for programming, but Haskell and other functional language can easily be used without any knowledge of category theory whatsoever.
- pdpi 4y ago> Haskell and other functional language can easily be used without any knowledge of category theory whatsoever. Yup! Haskell borrows heavily from category theory, and there's a lot of value in knowing the stuff, but people have also been productive in SQL for decades without any formal knowledge of relational algebra.
- ocschwar 4y agoI'd say lack of knowledge of relational algebra is the root cause of a lot of bad SQL database schema design. (Guilty as charged)
- dragon96 4y agoInteresting, could you give some examples of concepts from relational algebra that have helped inform your understanding of schema design? Asking as a practioner interested in learning the conceptual underpinnings :)
- dgb23 4y agoI think there is a simple, almost obvious, but very powerful concept that gets clearer when learning relational algebra: Everything is a relation. There is an important part about using an SQL DB which is about the engineering side of things, such as access patterns, indexing, efficient storage and so on. And then there is the side that is about relational expressions. An intuition of mine is that people who feel more comfortable with the second part, lean on SQL (and DB features in general) to do work for them, while eschewing things like ORMs.
- monads 4y agoI will get down-vote for sure but it's trivial this book and also the series "category theory for programmers". It's actually not very far from the content of several first pages of any book on set theory or logics. I find the ubiquitous idea is that "category theory" is more prestigous than "set theory", and some programmers, instead of seriously learning mathematics, think that learning category theory would fill up their lack of knowledge (in mathematics). It's quite contrary since category theory alone (i.e. without context) is trivial. Let's be honest: read this book and the series of the author, and try to use the acquired knowledge to prove some (even simple) mathematical theorems.
- francogt 4y agoThe author’s objective is to teach the category theoretical concepts that get used in FP. This is particularly important in Haskell since it uses some of these concepts (functors, applicatives, monads, etc.) as design patterns. He’s objective has never been for the reader to learn this and apply it to prove math theorems. Both set and category theory are foundational systems for mathematics (or attempting to be). Category theory being newer is trending and probably why you get the sense that it’s considered more prestigious. But I’ve never heard anyone claim it is more prestigious.
- monads 4y agoA lot of thanks for your feedback. I actually criticise the illusion (that the book and the series bring) that the category theory is "the ultimate source" of motivation in FP languages. On one hand, it's direct (and very natural) to reproduce some categorical structures in a FP language (e.g. Haskell, ML) since such a language is around functions and values. I doubt that such categorical structures should be considered patterns. On other hand, Haskell or ML does not come from the category theory, it comes from PCF as a language which is created to make program correctness proving is "easy". I dont want to mean someone using this book to prove mathematical theorems, I just want to say that it's superficial (about both category theory and computer science), and does not bring sufficient knowledge upon that we can build nontrivial results.
- matrix12 4y ago
- natly 4y agoI wish I hadn't bought into the functional programming cult so hard as a younger programmer. I thought it was the future and sacraficed learning and gaining mastery of OOP for that when OOP is a much more widely used and honestly now in hindsight probably better tool in most cases.
- thrwawy283 4y agoThis is my own inexperience with OOP showing: I keep wondering if trait/protocol/interface programming has made inheritance entirely worthless. Love Rust. I've been working in Java for other reasons, but I've been noticing more and more Rust-like things in Java over the past year.
- jimbokun 4y agoThat surprises me. My day job is programming in Java, and I use streams and lambdas everywhere. I use very little of OO concepts like inheritance. I try to make my data immutable and write functions and methods without side effects, wherever possible. Popular recent languages like Go, Rust, and Swift borrow a lot from functional programming paradigms. I'm curious where you are seeing OOP still going strong.
- jackblemming 4y agoYou brought up the worst part of OOP, inheritance. Which most modern OOP rarely uses. Since the 90s “composition over inheritance” has been a mantra. If you want to build strong arguments, focus on real issues. Not incompetent programmers abusing inheritance or abstract factory factories, because they can write just as awful code in functional programming. There are plenty of actual OOP issues to hate on, but that’s because there is no silver bullet.
- kvetching 4y agoFunctional programming is the key to AGI. Think of the brain as a collection of monads.
- drewcoo 4y agoIs it "Dao" instead of "Tao" to avoid some name collision/confusion with The Tao of Computer Programming? https://www.mit.edu/~xela/tao.html https://www.mit.edu/~xela/tao.html
- wjmao88 4y ago"Tao" is an old translation with (I think) the Wade-Giles system, while "Dao" uses the correct consonant that matches the Mandarin pronounciation of that word.
- iamcurious 4y agoIt has to do with how we carry words from Chinese to English. ``Is Daoism the same as Taoism? Traditionally, yes. The difference in spelling is a problem of transliteration from Chinese to English, where the Chinese pronunciation is somewhere between “Tao” and “Dao.” While it’s far more common to transliterate it as “Taoism,” it is actually pronounced closer to “Daoism.” "[1] [1]https://daoism.org/dao-or-tao/ https://daoism.org/dao-or-tao/
- bmacho 4y ago> Master Yoneda says: “At the arrows look!”
- rg111 4y agoIf anyone is interested in learning FP and how to think about it, I personally recommend three resources: 1. Martin Odersky's "Functional Programming Principles in Scala" MOOC on Coursera. Do not focus on the Scala part (5-10% of the course is about Scala). 2. The Little Schemer book. Among the best programming books U have ever read in my life. It actually teaches you how to think recursively. It actually does that. 3. Graham Hutton's Haskell book and YouTube playlist.
- joshbochu 4y agothanks!
- deleted 4y ago[deleted]