4 ms·
People (high school and college students) are still struggling to understand calculus nearly 3 centuries after Newton’s death. Some topics are just difficult fo
by chongli 3y ago
People (high school and college students) are still struggling to understand calculus nearly 3 centuries after Newton’s death. Some topics are just difficult for many people. Does that mean we shouldn’t bother teaching them?
- CyberDildonics 3y agoCalculus is necessary. It wasn't invented as a set of restrictions, it was just just discovered and formalized. Haskell is not a discovery of something that already existed. It isn't the only programming language out there. There are dozens of examples of other languages that people use more easily. The problem was something invented, not something that has to do with the underlying principles of programming. If there are easier ways of teaching calculus, maybe those should be used. Actually that is happening now as youtube videos and web pages help visualize concepts.
- epgui 3y agoMonads are a discovery from category theory.
- CyberDildonics 3y agoThat's great for category theory. If most people are confused why they're in a programming language, maybe it's time to admit that a language is influential but not made for general purpose productivity.
- ChadNauseam 3y agoC++ doesn’t get this treatment when it comes to template metaprogramming, Python doesn’t get it about metaclasses, etc. Every language has tricky parts. The difference is that Haskell’s trickiest part, Monads, are actually very simple. They’re simple enough that they can be explained in a short article, so that causes people to write lots of articles about them.
- chongli 3y agoThis is all true except for the claim that monads are Haskell’s trickiest part. Monads are Haskell’s most infamous part but far from the trickiest. There are a lot of Haskell libraries that make the type system twist itself into a pretzel to achieve some really funky things. See Edward Kmett’s lens library for one example.
- worrycue 3y ago> C++ doesn’t get this treatment when it comes to template metaprogramming Quite sure a lot of people hate C++'s template programming. > They’re simple enough that they can be explained in a short article, so that causes people to write lots of articles about them. Or ... there are a lot of articles because people keep finding new ones to read because they still don't get it after reading the previous 100 articles.
- CyberDildonics 3y agoIn their basic form templates solve an obvious problem in an obvious way. It doesn't make sense to make the same data structure for every type, you want to make the data structure generic and sub in the type every time you use it. The extremes of template meta programming are self imposed by people being fancy while writing libraries and the value is questionable. On top of that no one thinks that C++ templates are the ideal way to do complex meta programming.
- gilmi 3y agoMonads are a bit like exiting vim. The complexity is exaggerated to the point of a meme, but in reality not very difficult, and they can be quite useful.
- epgui 3y ago> and they can be quite useful That's a bit of an understatement, seeing as it's... I mean is it even possible to write a non-trivial application without accidentally implementing a monad? Most people write monads all the time, and then their head explodes when someone calls it by its name.
- epgui 3y agoCan you admit that you just moved your own goalposts here? Your claim was literally that monads were invented rather than discovered.
- CyberDildonics 3y agoI said that haskell was invented and not discovered. The person I replied to was comparing calculus to haskell.
- chongli 3y agoCalculus is necessary I agree. It’s very important. It wasn't invented as a set of restrictions, it was just just discovered and formalized. That’s a bit too casual of a dismissal of an active, major branch of philosophy of mathematics which holds that all mathematics is invented. For fun, and what I take as evidence supporting that argument, look up Michael Penn on YouTube to see how nonstandard analysis works and how you can define the operations of calculus in vastly different ways than you might have learned in school. The main difference between calculus and monads is that the former traditionally belongs to the domain of analysis and the latter to algebra. That monads haven’t taken off to the same degree is a matter of luck. The vast majority of mathematics has found no use whatsoever outside of pure mathematics. Finally, I want to say that I think it’s a mistake to think of monads as some set of restrictions that Haskell’s designers put in place to keep people out, like some twisted “you must be this tall to ride the rollercoaster” gatekeeping. They discovered an algebraic pattern in a bunch of commonly used data types and decided to make it into a type class. For them, it solved a major problem of the language at the time: how to deal with effects in a language that uses lazy evaluation.
- CyberDildonics 3y agoThat’s a bit too casual of a dismissal of an active, major branch of philosophy of mathematics which holds that all mathematics is invented. This is the problem. You keep talking about "philosophy of mathematics" and I'm talking about programming. Finally, I want to say that I think it’s a mistake to think of monads as some set of restrictions that Haskell’s designers put in place to keep people out, like some twisted “you must be this tall to ride the rollercoaster” gatekeeping. I don't know if anyone thinks that. It just isn't useful to write programs with an arbitrary albatross around your neck because someone else is obsessed with philosophy and set theory.
- chongli 3y agoYou keep talking about "philosophy of mathematics" and I'm talking about programming. You made a specific claim that calculus was discovered but that monads are invented. Are you walking back that claim? Fine. It just isn't useful to write programs with an arbitrary albatross around your neck because someone else is obsessed with philosophy and set theory. I've tried to engage with you in good faith but now it appears that you're just concern trolling. The article is an educational piece about monad transformers. Nowhere is it implied that you, specifically, need to use Haskell in your work. If you can't see why monads are useful, why not ask about that?
- Twey 3y agoMonads are similarly fundamental in the theory of programming/computation — when you start considering effectful computation at a deep level, monads come up pretty quickly, in a way that is independent of the programming language in question. That doesn't mean they'll stand the test of time as well as calculus has — computer science has had much less time than analysis (or physics, as calculus originally was) to get to the bottom of things — but it was at the time Haskell was designed the most fundamental way of talking about these things, and still a main contender. There are other abstractions with nicer properties, like algebraic effects (which compose nicely by default and therefore don't require an equivalent of monad transformers), but they're not quite equivalent in power — whether they're ‘good enough’ to become the de facto representation of effects depends on how we end up capturing the remaining part. Haskell doesn't impose monads on a more fundamental notion of computation that other languages expose directly, which is how I interpreted your comment; rather, other languages force a particular monad on you at the language level, whereas Haskell lets you choose your monad and even mix and match different monads that suit your program. This does introduce some complexity in exchange for the additional flexibility, and people may reasonably differ on whether that flexibility is worth it, but the complexity results from exposing something more ‘fundamental’, according to our current theories of computer science, that other languages hide from you.
- CyberDildonics 3y agowhen you start considering effectful computation at a deep level, monads come up pretty quickly You say that, but they only seem to come up when dealing with haskell.
- one-punch 3y agoMonads are there in computations that we care about, regardless of the implementing programming languages (e.g., Python, C, Assembly, Turing Machines). Just that Haskell is famous for considering Monads as a first class concept, while many programming languages do not name and reason about them (in Python, C, Assembly, etc.). This is similar to structured loops and function calls (not GOTO), which are in computations that we care about, regardless of the implementing programming languages. Some languages do not name and reason about them (e.g., Assembly, Turing Machines). While it is possible to program without raising the level of discourse, this is discouraged (considered harmful), as it lacks safety, hurts productivity (developer velocity/experience), and scales worse. > > when you start considering effectful computation at a deep level, monads come up pretty quickly > You say that, but they only seem to come up when dealing with haskell. "when you start considering structured computation at a deep level, loops and function calls come up pretty quickly" "You say that, but structured loops only seem to come up when dealing with high level languages." This situation, where a higher level programming language delivers more power (in this case, scales with better developer velocity/experience) but a lower level programmer resists, has been observed many times. Paul Graham calls this the Blub Paradox [1]. What's so great about Lisp? And if Lisp is so great, why doesn't everyone use it?... I'll begin with a shockingly controversial statement: programming languages vary in power. ... But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn't realize he's looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub. And using a powerful high level language is "The Secret Weapon" behind the success of Viaweb [1]. Haskell is also a secret weapon for those who know how to use it. [1]: http://www.paulgraham.com/avg.html http://www.paulgraham.com/avg.html "Beating the Averages"
- mrkeen 3y ago> It wasn't invented as a set of restrictions, it was just just discovered and formalized. You share good company with this observation. Philip Wadler (who put the monads into Haskell) often talks about functional languages having been discovered, rather than invented. Haskell is System F (The polymorphic lambda calculus) with the Hindley-Milner type system. (Both Hindley and Milner independently discovered it.) Curry and Howard observed that this type system corresponds to 1st order logic - types are propositions and programs are proofs, e.g. modus ponens: P implies Q P is true Therefore Q must also be true. H-M 'App' rule: f has type P -> Q x has type P Therefore f(x) has type Q. You don't have to dig far into Haskell to find the 'discovered' stuff.