6 ms·
>Throwing a beginner head first into recursion and restricting all their programs to be a singular composite of expressions is the, unfortunately, best way to t
by coolsunglasses 11y ago
>Throwing a beginner head first into recursion and restricting all their programs to be a singular composite of expressions is the, unfortunately, best way to turn away a beginner.
The alien-ness is what makes it difficult, not the actual design. Less design surface area makes it considerably easier to learn in that respect. That doesn't mean Haskell is easy to learn in general, for now. There's a huge difference in jumping from Ruby->Python->JS vs. learning how to program in terms of a foundation built on lambda calculus.
"singular composite of expressions" - this doesn't mean a lot, and doesn't really fit, I think. You can hand-wave do syntax and pretend you're writing imperative code in IO. A lot of people do that when first starting out so they can get the hang of things. SPJ (OG Haskell honcho & compiler hacker) likes to say that Haskell is the nicest imperative programming language to use. I'd tend to agree :)
Takes practice. You need exercises.
If you haven't already seen it, I'd recommend taking a look at the guide I've maintained on how to learn Haskell: https://github.com/bitemyapp/learnhaskell https://github.com/bitemyapp/learnhaskell
- bjt 11y ago+1 to "You need exercises." I'd read through Learn You a Haskell about 1.5 times but not really felt like I knew the language. The exercised from the CIS194 course in your links were a lot more effective, though I've only made it through the first 3-4.
- crimsonalucard 11y agoI'm not bad with haskell and I like it a lot. I meant like beginner as in a beginner in programming in general. I feel the only reason why I was able to pick it up really quickly and like it was because I wasn't a beginner.
- Arcanum-XIII 11y agoNot too sure about it - some things are very different than your imperative or OO language. But then it offers lot of guarantees that help a lot.
- crimsonalucard 11y agoSure but those guarantees mostly help the user deal with problems when your application gets really complex... issues beginners don't really think about.
- wz1000 11y agoRecursion and loops will be equally alien to a beginner. Here[0] is an interesting blogpost by somebody who learnt Haskell as their first programming language. Mutation and regular imperative programming are as alien to her as immutability and functional programming would be to somebody who has exclusively programmed in an imperative language. [0]- https://superginbaby.wordpress.com/2014/11/18/learning-haskell-as-a-nonprogrammer/ https://superginbaby.wordpress.com/2014/11/18/learning-haske...
- crimsonalucard 11y agoI doubt that. Loops are way more intuitive than recursion. In other words, it is easier to think of something as a series of repeating steps then it is to think of something as a self referential entity.
- efnx 11y agoIn recursion you don't necessarily have to think about self reference. Instead simply think of the return value of the function. I think the only time I use recursion in Haskell is when I need to mutate some parameters over a set of items (which is often) but I don't have to think about the fact that the function is recursive - I only have to ask myself "how do the parameters change while traversing the set?" Lastly, if you don't like the idea of recursion you can often do the same with a fold by keeping your parameters in the accumulator as a tuple or other such sum type. My main point being that none of these things (programming patterns and strategies) are intuitive until you have some background.
- crimsonalucard 11y ago>My main point being that none of these things (programming patterns and strategies) are intuitive until you have some background. That's my point. I'm saying in addition to this, loops are by far one of the easier patterns and strategies to become familiar with. think about it. By knowing what a function is... recursion can be taught as a logical next step without introducing any additional language primitives. Yet most computer science classes will still teach looping syntax before even touching upon recursion. Why? Because looping is way easier to grasp then recursion, theoretical elegance be damned.
- wetmore 11y agoI wanna thank you for the work you've put into helping people learn Haskell, I've pointed a lot of people towards your guide.
- dllthomas 11y ago"singular composite of expressions" - this doesn't mean a lot, and doesn't really fit, I think Actually, while the presentation here was perhaps overstated, I think there is an issue here. The fact is that other languages split things into expressions and statements, such that the combinations of these things is more limited. This has a downside, in that you are not as free to cut things in the way that best fits your domain or your solution. But it has an upside in that where you cut becomes more obvious, and learning the appropriate size for chunks (particularly as you come back and repeatedly modify the same pieces of code) is an additional thing one needs to learn in Haskell that isn't entirely obvious (at least, it wasn't for me, and I feel I could still do much better than I do).
- coolsunglasses 11y agoI think you've got a point there that can be reinforced by looking at the ratio of Haskellers vs. those comfortable with splitting things out to (.) or (>=>) Critically, however, one does not need to be good at abstracting out code in Haskell to be happy and productive using Haskell. We need to be careful not to move on the goalposts on our beginners, it's deeply unfair and frustrating if we make them think they can't do anything at all until they can do it perfectly.
- dllthomas 11y agoI think I agree with all of that.