7 ms·
I'm currently learning and loving haskell. I, however, find it unlikely that this language will ever become mainstream. Throwing a beginner head first into rec
by crimsonalucard 11y ago
I'm currently learning and loving haskell. I, however, find it unlikely that this language will ever become mainstream.
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.
But damn, it'd be an awesome future if I'm wrong.
- 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.
- 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.
- bsznjyewgd 11y ago>recursion and restricting all their programs to be a singular composite of expressions Simple effect-free loops in an imperative language translate directly to a recursive function, which is just a labeled loop that makes explicit what/how state is manipulated each loop iteration. (Edit: For effectful loops, it's common practice in imperative languages to interleave the effects with the program logic. (Un?)fortunately, Haskell discourages this practice and encourages you to refactor the pure parts of your program from the effectful parts. This might make your program more reusable and testable, but it's an obstacle if you are just writing a fancy Hello World and want to get stuff done.) The singular composite of expressions is not a necessity, but to avoid it you have to give names to all your intermediate states, whereas a typical imperative language reuses the same name repeatedly.
- michaelochurch 11y agoThe singular composite of expressions is not a necessity, but to avoid it you have to give names to all your intermediate states, whereas a typical imperative language reuses the same name repeatedly. Interesting way to put it. I like to tell people that they program in languages where every type signature is "Any -> IO Any". It's technically true, but it gets some weird looks.
- saryant 11y agoLast weekend at LambdaConf (functional programming conference in Boulder) we were joking that all programming is fundamentally just a function of String -> Any. Fewer weird looks when you make that joke surrounded by Haskellites and Scalaistas.
- michaelochurch 11y agoHow was LambdaConf, by the way? I wasn't able to make it this year but I'd like to go next year.
- saryant 11y ago
- michaelochurch 11y agoIt will not become dominant in the way that Java was, but I think Haskell should and can aim for 5 to 15 percent mind-share. Once we get to a point where people who want to work in Haskell or Haskell-like languages can do so, and where most programmers are aware that Haskell is in fact a production-ready language right now, I'll consider that a victory. Scala and Clojure proved that far better languages than Java could actually be practical, even in "the enterprise" where Java reigned, but there are a lot of reasons why it's even better to be off-JVM and Haskell seems like a natural step. Also, as programmers get further along and more experienced, they tend to prefer static typing because dynamic typing simply doesn't scale on multi-developer projects unless you have a very disciplined and competent team-- which is not all that rare, but it's hard enough to make happen that the (perceived) negatives or difficulties of static typing are a rounding error in comparison.
- rwallace 11y ago> prefer static typing That's all very well, until you look at a few Java programs in the million line range, and it turns out the source code for most of them also includes a million lines of XML, and the reason for that is Java's type system doesn't really match the problem domain, so people resort to XML basically as a way around the type system. And if you're going to be effectively writing a large chunk of your program in XML, you'd be better off using something like JavaScript or Python that is actually designed to be a dynamic programming language. Now you could make the counterargument that this is because Java's type system isn't very good and if you used a language like Haskell with a better type system you'd have better results. Maybe, but then the objective isn't so much 'use a static type system' as 'make Haskell palatable to a decent percentage of programmers'. I'm not saying it's impossible to do that, just that it's a different challenge and needs to be understood for what it is.
- michaelochurch 11y agoI don't consider Java to be statically typed. Sure, there's some compile-time type checking, but OOP is naturally dynamically typed. This is why you end up subverting the type system (I believe it's called "POJO") all over the place when you write Java. To be pedantic about it, Java has two type systems. It has a bottom-up, mostly static, ALGOL-inspired type system with primitives and arrays (e.g. int, char[], double[][]) and a top-down, semi-dynamic type system for object types. Maybe, but then the objective isn't so much 'use a static type system' as 'make Haskell palatable to a decent percentage of programmers'. I'm not saying it's impossible to do that, just that it's a different challenge and needs to be understood for what it is. I agree. What would you suggest? The issue, I think, that Haskell has is not that the language is hard to use, but that the type signatures can be anywhere from obvious to counterintuitive and, to a beginner, horrifying. The issue is that the "best" (most general, most mathematically accurate) type signature isn't always the one that gels with what we want from it. An example would be the Lens type signature. It takes some on-paper, figure-it-out work to understand why this is the right type signature. It's this Rank-2 beast: type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t When most people would find it more intuitive to have something like this: type Lensish s t a b = L {get :: s -> a, set :: s -> b -> t} Sometimes in Haskell we go for full generality and mathematical correctness, which is great, but also makes the language harder to understand. Then there are the names. Personally, I don't find "monad" or "functor" to be that bad. They're new concepts that must be learned, but they're a lot easier (and more useful!) than OOP's 23 design patterns, most of which are horrible.
- graffitici 11y agoI've looked into Haskell, and loved it. Even though I've never used it for any code that ran in production, and I doubt I ever will, I really appreciate the contributions of the Haskell community. I think they had a great part in the popularization of type safety. Case in point, this talk about what Python can learn about Haskell: https://www.youtube.com/watch?v=eVChXmNjV7o https://www.youtube.com/watch?v=eVChXmNjV7o
- coolsunglasses 11y agoSpeaker of that talk launched http://ghcformacosx.github.io/ http://ghcformacosx.github.io/ a couple weeks after Bay Hac '14. I wonder sometimes if it was already on his mind or if it was because people were complaining about Platform at Bay Hac. Bob is awesome :)
- progman 11y agoI think the language itself is not the problem but the environment. It takes a lot of effort to setup a working system. What beginners want is a "QuickHaskell" -- an out-of-the-box working Haskell environment with all batteries included -- in the sense of QuickLisp, for all platforms (not only OSX). I know FP Complete but this is a web service. It would be nice to have an instantly working environment for offline programming. Why did the Haskell community not promote EclipseFP? It is (was?) such an awesome beginner's IDE. The maintainer has quit due to lack of support. http://jpmoresmau.blogspot.de/2015/05/eclipsefp-end-of-life-from-me-at-least.html http://jpmoresmau.blogspot.de/2015/05/eclipsefp-end-of-life-...
- fractalsea 11y agoHave you tried the FP Haskell Center IDE[1]? It's completely web based, and should make it very easy to set up projects, bring in stable libraries and do builds. I would imagine this would be very useful for beginners. There's more information in the linked Communities Report. [1] https://www.fpcomplete.com/business/haskell-center/overview/ https://www.fpcomplete.com/business/haskell-center/overview/