6 ms·
Can I ask a question about Haskell? I see a lot of excitement about it, but, honestly it seems a bit over my head and I'd love to understand. Deep learning, f
by paulsutter 11y ago
Can I ask a question about Haskell? I see a lot of excitement about it, but, honestly it seems a bit over my head and I'd love to understand.
Deep learning, for example, has opened the door to some pretty incredible advances, I'm astonished monthly at least by what people are accomplishing. Stuff that's getting close to the uncanny valley.
I see equally smart people enraptured with Haskell. And, maybe it's just over my head, but so far no practical advance is apparent. To me at least. So, for the sake of the nonbelievers, it would be grand to share some of the hopes that merit the great energies that go into languages like Haskell.
(ps. thanks to Scrollaway for asking, below)
- moomin 11y agoHaskell is, frankly, hard to learn. But the interesting thing about learning Haskell is that you feel like you're actually learning more about coding and computation, whereas most languages just feel like you're learning a new syntax for doing the same thing. In general terms, Haskell has an unparalleled ability to be both precise and flexible at the same time. At least, that's why I like it.
- paulsutter 11y agoI like that description, it conveys a sense for what can be appealing about it. But, if I look at Deep Learning, I see a freight train to the future. If I look at Haskell, I see a lot of... well, debating about... things.. well I just don't see where it's going. I get the sense that it's a gleeful little clever club that exists as an alternative to doing actual work. And, where's the counterexample, Haskell is a freight train to where? What's the future that Haskell brings? This is really a sincere question. I've been programming long enough to feel the limitations of existing tools. But, will humans even be coding in 30 years?
- adwn 11y ago> But, will humans even be coding in 30 years? I don't see the connection between Deep Learning and removing humans from the software engineering process, so yes, humans will still be coding in 30 years. (and some of it will still be done in C, and maybe even in COBOL)
- rifung 11y agoMost proponents would say it helps you write bug free software or to write software in a cleaner way. I'd agree with that, and even say it's much more fun than other languages I've used (Python, Java, Ruby, etc). But in the end I don't think it actually enables us to do anything that we haven't been able to do before, so it's probably not as significant as Deep Learning in that respect. To be completely honest, I am not convinced it has huge practical application, as I don't think it will ever be picked up by industry in its current form. The reason I don't think it will be adopted by industry is that a company's concerns are typically not really aligned with a programming language researcher's concerns. For example, a company probably wants a language that is easy to hire for and easy to train for, and Haskell is definitely neither of these things. Also, from what I've heard, it's very difficult to debug and benchmark Haskell programs, perhaps due to its laziness. Take all this with a grain of salt though as I've only been learning it for 1 year and read the majority of two books on it; I'm far from an expert.
- pjc50 11y agowill humans even be coding in 30 years? Yes. People will probably still even be writing in C and C++ in 30 years. The same predictions were made about "4GLs" 30 years ago and have not come to pass.
- seanmcdirmid 11y agoDeep learning wasn't advancing at a 2X rate/year 30 years ago. Past performance does not indicate future performance.
- kqr 11y agoBut it does give a strong hint. I personally don't prophesise somethings demise in a shorter timespan into the future than it has existed for. I find that to be a good rule of thumb. High-level programming has been around for 50ish years, so we probably won't get rid of it for at least another 50.
- seanmcdirmid 11y agoIt is a heuristic that assumes no disruption. If someone figured out how to approach human-level intelligence in the next 30 years, then programming will die then. Are we certain? No. But it is a definite possibility. There is also a possibility of a cybernetic hybrid between programming and machine learning that also doesn't really resemble today or yesterday's HLLs.
- moomin 11y agoI'm not sure Haskell's a freight train anywhere. :) It's an all stations passenger train to deeper understanding. More generally, learning Haskell (and to a great extent any programming language) is about a different way of doing things. Deep Learning is a thing to do. (It can also be a way of doing other things, but my point is that they're at different levels.) With that said, your time is limited. Studying Haskell, Deep Learning or Statistics (an option that is criminally underrated) is a choice you have to make, and Haskell isn't necessarily the best use of your time. If you feel like dipping your toe in the water, though a) install stack https://github.com/commercialhaskell/stack https://github.com/commercialhaskell/stack b) try doing this course (http://www.seas.upenn.edu/~cis194/spring13/lectures.html http://www.seas.upenn.edu/~cis194/spring13/lectures.html) and _do the homework_. If you find you're enjoying it, you'll have your answer. If you're not enjoying it, it's probably not worth your time. And for the record, I have no idea what some of the top-flight Haskellers are talking about either. But maybe one day I will.
- chriswarbo 11y ago> if I look at Deep Learning, I see a freight train to the future... will humans even be coding in 30 years? If the implication is that machine learning will make human programmers obsolete, then no that won't happen. What will happen is that more programmers will be spending more time tweaking, training and debugging/reverse-engineering machine learning systems.
- fho 11y agoWhat hopefully will happen is that programmers spend less time tweaking and debugging programs. Haskell is actually on the forefront with this with systems like [Haxl](https://code.facebook.com/posts/302060973291128/open-sourcing-haxl-a-library-for-haskell/ https://code.facebook.com/posts/302060973291128/open-sourcin...) at Facebook where, after some front-up development, speed and safety is increased for the users of the system. (Disclaimer: Haskell Fanboy)
- seanmcdirmid 11y agoHaskell has this philosophy that you first think really hard about what you want to do, then write an elegant well typed program in Haskell to do it. The real world is usually much more messy, the problem and solution are not well defined, you will need to start coding just to figure out what you need to really code. So Haskell assumes well typed code can do no wrong, but often we are debugging our own mental models.
- fho 11y agoI found that once you know your way around the basics (which the FTP mentioned here is a big part of), it becomes quite trivial to just "hack away". I am now 4 years aboard the Haskell train and use Haskell for scripting work I would have used bash or Python before. That said I have about 10 years of practical Java experience under my belt and Haskell was refreshingly different. But before this thread get's out of hand I'll keep my fanboy mouth shut ;)
- jamesbrock 11y ago> What's the future that Haskell brings? That's a great question, paulsutter. The great computer scientist Peter Landin in 1965 asked a similar question about the future of programming languages. To answer the question, he imagined a wonderful futuristic programming language with lambda calculus at its core. He named that language ISWIM, and described it in a paper entitled The Next 700 Programming Languages. Haskell is essentially ISWIM with a Hindley-Milner type system added to it. https://www.cs.cmu.edu/~crary/819-f09/Landin66.pdf https://www.cs.cmu.edu/~crary/819-f09/Landin66.pdf Haskell is science fiction from 1965. The future that Haskell brings is right now, the 21st century future.
- nikanj 11y agoTo me, it was mostly about new ways to force the compiler consider a number a number. You have one integer from monad a, another from monad b and want to use them as parameters for a function in monad c. I mean, I understand /why/, but sometimes I really longed for a blunt instrument.
- tempodox 11y agoOpportunities multiply as they are seized. The more computational models you get under your belt the broader your horizon will be. And since the computational model of Haskell is quite unique, you will almost certainly learn more than just new syntax. The same would be true for (e.g.) Prolog, whose computational model is non-mainstream as well. That difference means, you can't understand this new thing in terms of what you knew before, but you need to grok new concepts (not just syntax). As the adage says: “If you know exactly what you're doing, you're not learning anything”.
- rhaps0dy 11y agoI'm not sure how much of it has been proven, but this language helps a lot with correctness in software engineering. The compiler and type system conspire to make the software correct when it compiles more often than not. Maintenance work on projects is easy because you never have some global state to worry about, instead, everything you need to understand a function and modify it is in that function's definition. And nice libraries. But other languages have them bigger and of similar quality.
- exDM69 11y agoHaskell is a programming language, it's just a tool - just like you don't expect some profound practical advantages from, say Python, C# or Rust, you should not expect Haskell to be magically better than others. That being said, Haskell has been at the forefront of programming language research since its inception in the 1980s. It may be more academic kind of advances but things have trickled down to mainstream languages, e.g. F# and C# have had influences from Haskell (particularly because Simon Peyton-Jones is employed by Microsoft Research). Scala and other languages have had some influence too. Things such as Parser combinators have emerged from the Haskell world and have been adopted to many programming languages since. Haskell is exciting because it takes a no-compromises approach to the paradigm it is based on. It's purely functional and lazy, something not taken to such extremes in any prior languages. Whether this is the right(tm) approach to take is open to debate. If I had to summarize in one sentence: Haskell is a research language that is practical - learning it will make you a better programmer even if you never get the opportunity to use it in your day job.
- fho 11y agoJust another Haskell-influence on mainstream languages: Pythons list-comprehensions are verbatim copied from Haskell. This is even acknowledged here: https://wiki.python.org/moin/PythonVsHaskell https://wiki.python.org/moin/PythonVsHaskell
- crdoconnor 11y ago>I see equally smart people enraptured with Haskell. And, maybe it's just over my head, but so far no practical advance is apparent. The advantages appear to be limited to highly complex functional code (i.e. big black boxes of code without side effects). IIRC facebook has a spam filter written using it. Since most of the industry involves code where the functional aspect isn't all that complex and the side effects are, the practical advances aren't all that relevant for a lot of people. Except, perhaps, for the impact Haskell is having on other more mainstream languages' design.
- thoughtpolice 11y agoHaskell does not eliminate side effects. It allows you to control them. You do realize that system you described - Facebook's Sigma - is a real-time, massively concurrent online spam-fighting system, that automatically and implicitly makes your code concurrent for all operations, can optimize it, and has automated caching/batching request mechanisms in place to talk to external systems (Graph databases, SQL, cache servers) in an optimal way while reducing things like round tripping, with naive code? (e.g. it can automagically parallelize and optimize the "N+1 Query Problem" into an efficient query that minimizes duplicated requests and round trips, with no intervention, and the single 'query' can operate over multiple data sources like mentioned previously.) In other words: it does side effects all the time, and makes them manageable in ways you could only dream of in other languages. Did I mention all of that was done in a library? :) I mean, we definitely have a sales problem, don't get me wrong. We could spit these stories better or clean up the presentation. I can list off a dozen things Haskell is poor at, or probably an infinite number given the time. But you sort of chose literally the worst example in the world to make your point. I would suggest you actually spend some time with the language in anger. It is not easy. But I've been writing 'real world' software in Haskell for years, and it's no more difficult or 'magical' than any other part of being a software developer. It's just more rewarding because my code works far more often. And working code seems to be something that's rare in the software world these days ;)
- crdoconnor 11y agoYou misunderstood me. I wasn't saying that it eliminated side effects. I was saying that it brought no great advances with respect to side effects, and most people write code that mostly only does side effects. This is why OO had such a great impact on the business world and functional programming didn't. It's actually pretty rare for businesses to write highly complex mostly functional code (a spam filter is one exception), and that is where Haskell really shines. >I would suggest you actually spend some time with the language in anger. It is not easy. But I've been writing 'real world' software in Haskell for years, and it's no more difficult or 'magical' than any other part of being a software developer. It's just more rewarding because my code works far more often. And working code seems to be something that's rare in the software world these days I've tried it and I've seen its advantages and I'm content to remain with python for the time being. Python's type system isn't as good and that does sometimes cause bugs I wouldn't get in Haskell which I fully understand, but I'd consider the difference incremental. It's not any kind of great leap forward and I think my code would only be slightly less buggy in equivalent Haskell. On the other hand, Python has a wealth of packages and an ecosystem that Haskell simply doesn't even come close to matching. Stable, working code is rare, I'll grant you that, and weaker type systems definitely make programming more of a balancing act, but there's a trade off to be made between stronger type systems and not having to rewrite a ton of working code which already exists.