3 ms·
The solutions to side effects that Haskell introduces are high minded concepts that take time to understand, especially as they are traditionally introduced. Bu
by bananarchist 4y ago
The solutions to side effects that Haskell introduces are high minded concepts that take time to understand, especially as they are traditionally introduced. But no programmer coming to Haskell has issues with
addTwoNumbers a b = a + b
You can get quite far into programming concepts with just pure functions and the IO monad, the latter of which doesn't need to be understood for the purposes of printing output/scanning input. When you get into file manipulation and network calls it gets harder to avoid the tough topics, certainly, but that's also true of Python as this is when you get into async programming (and thus many pitfalls of mutability) and context blocks (monads by any other name).
With that said the only programming language beginners should work with is JavaScript because you have access to its interpreter anywhere you have a web browser (even without an internet connection!)
- gregjor 4y agoI agree that starting with Javascript makes sense, everyone has it in their browser. But because JS only runs in the browser you quickly run out of interesting things you can do with it unless you want to throw yourself on the node/npm bonfire, which is sure to scare off beginners. Haskell makes you think in terms of functions from the beginning (as your example illustrates). I'm sure we agree that functions represent a powerful and important core concept, but that style does not have the obviousness of "print a + b" for most people. Even children understand doing things step-by-step, in order. Most adults don't get the concept of functions right off unless they come from a mathematics background. I don't miss BASIC (my first language as a teenager) in terms of programming languages, but I do miss having such a simple and usable tool available. I have tried to get all three of my kids interested in programming, with Python, Javascript, PHP, and none of them got hooked like I did at their age, when all I had was timeshared BASIC over a teletype. I can see their eyes glaze over as I explain how to install and start up Python and get it to do something -- the same look I get when they want to cook but not do any prep or reading recipes. My son fell into some programming backwards by learning enough Lua to customize Minecraft. But the social/play aspects of modern computer games have, I think, turned kids away from learning programming. If you experience computers through sophisticated games from childhood, as my kids have, getting Python to print your name or add two numbers seems unimpressive.