10 ms·
Why I think Haskell is the best general purpose language as of June 22 2019
- adamnemecek 7y agoI think that julia is giving haskell a run for its money. I find it more productive for numerical mathematics (maybe not formal methods or abstract algebra).
- tmalsburg2 7y agoThe title says "general purpose language".
- adamnemecek 7y agoI wouldn't call haskell general purpose. He lists a couple of areas he cares about.
- philzook 7y agoI think Haskell is more general purpose than people give it credit for. The domains I care about are general web dev for stuff, formal methods, and numerical computation. I do not use Haskell day to day for numerical computation (I tend to use python, which I very much like), but it does bring to mind interesting ideas http://www.philipzucker.com/reverse-mode-differentiation-is-kind-of-like-a-lens-ii/ http://www.philipzucker.com/reverse-mode-differentiation-is-... https://t.co/HhUNpl0T5m https://t.co/HhUNpl0T5m
- nineteen999 7y agoI think there is a bit of a problem with the definition of "general purpose" here, it's very dependent on the eye of the beholder. What might work for web programmers might not be of much use to more desktop centric programmers. How portable is Haskell? Does it have a wide range of graphics/sound/UI libraries available? Are those libraries available on a large number of the platforms that Haskell runs on? This are the kind of questions that many C/C++ programmers considering alternatives might ask when considering whether other languages are general purpose enough for their needs.
- philzook 7y agoI think you bring up very valid points.
- philzook 7y agoI agree on the promise (perhaps already realized) of Julia. The library ecosystem there is so, so incredible. The language is custom formed to it's intended domain of numerical computation. I've been trying to ween myself off of python for these purposes. Needless to say, my pushing of Julia also meets with a great deal of pushback. I have also had some setbacks. The 1.0 changes hurt my learning a bit. I don't like how it doesn't play well with brew. I feel like it is forcing me a bit into a Jupyter notebook style, which is not my favorite. All of these are small quibbles ultimately.
- adamnemecek 7y agoUse juno. I was in the same sitch re 1.0 update, it's gotten better. Why do you need brew interop?
- philzook 7y agoA small quibble. I hate downloading binaries from websites. I hate ever going outside my package manager. I want to be able to get the latest version. I think many people prefer Julia the way it is.
- adamnemecek 7y agoYou can use brew https://julialang.org/downloads/platform.html https://julialang.org/downloads/platform.html
- philzook 7y agoWelp, my apologies. I'm a doof.
- neonate 7y agohttps://web.archive.org/web/20190623200107/http://www.philipzucker.com/why-i-as-of-june-22-2019-think-haskell-is-the-best-general-purpose-language-as-of-june-22-2019/ https://web.archive.org/web/20190623200107/http://www.philip...
- jes5199 7y agoHaskell people claim that combinators and monads are clear, but in practice the code seems to be write-only. Each combinator might be simple, but that doesn’t mean that the result can be understood easily. And monads have the same problem, except they aren’t simple.
- jsjolen 7y agoJavascript programmers seem to have no problem using a monad every day (promises), and they are huge fans of do-notation in the from of async/await. Imperative programmers do not seem to have an issue with the idea of assignment, why are monads problematic? By "combinator" do you mean combinator as in the combinator pattern? I have no idea what value your comment brings us except a way for people who already agree with you to give you upvotes, and what's the point in that?
- jowiar 7y agoThe big issue with Haskell isn’t the concepts — it’s the syntax. ASCII art as code is an abomination. Being unable to read code upon first glance it makes it inaccessible.
- jes5199 7y agogetting people who already agree with me to give me upvotes is the whole point of this website
- AnimalMuppet 7y ago> Imperative programmers do not seem to have an issue with the idea of assignment, why are monads problematic? This drive-by-question style makes it hard for me to know what your real point is. Are you saying that an assignment does the same thing as a monad? OK. That it is a monad? I doubt it; assignment doesn't have the right operators (you might argue that it does, but you'd have to really stretch it.) That it's just as simple and easy to understand as a monad? I call BS. > I have no idea what value your comment brings us except a way for people who already agree with you to give you upvotes, and what's the point in that? That kind of rhetoric is against the site guidelines.
- philzook 7y agoAuthor here. This is deeply amusing that among all the posts I write, the rushed half cogent Haskell rant rehashed for the billionth time gets the most attention. I guess that makes sense.
- timClicks 7y agoI find that with anything I write. The considered post that took weeks gets no attention, but people latch on to my 10 second tweet
- thrower123 7y agohaha. Hahahahaha. hahahahahahahahahaha. Okay bub, here's your troll card, you are officially a member.
- Ice_cream_suit 7y ago"I have a tendency to joke about almost everything and have put forward that we use many interesting but not practical languages in the same tone that I suggest Haskell. This was a tactical mistake." Cry wolf too often ot be an assh*le too often, and expect this....
- philzook 7y agoHaskell is very, very funny. Coq brings tears of amusement to my eyes. I couldn't and can't resist. (shrug)
- 0815test 7y agoHaskell is nice, but it has plenty of room for improvement. The duality of strict vs. lazy eval is not really treated in an elegant or principled way, for example - which is one of the drawbacks OP mentions in their blogpost. There are theoretical approaches (polarity, focusing) that might work well for this.
- philzook 7y agoInteresting, thanks! There are many exciting possibilities for the future of programming. My point to my friends is that I actually think Haskell is a shockingly pragmatic choice right now, despite how much my goofing around implied otherwise.
- dreamcompiler 7y agoI'm a Lisp expert. Learning Lisp (a long time ago) blew my mind. Learning Haskell (recently) blew my mind a second time. There are some things I can express in Haskell that I can't -- at least not easily -- in Lisp. And that had never happened before to me, with any other language.
- projectileboy 7y agoI’m intrigued - can you share an example?
- chongli 7y agoI'm not the parent so I can't answer from their experience, but I will say that laziness in Haskell lets you write functions that cannot be expressed in Lisp without macros. Some simple examples are when and unless, which work like if...then and if not... then. In most languages, these would be control flow statements built into the language (or not) and could not be written by the user. In Lisp you could implement these with macros, with all of the caveats that apply. In Haskell they're just ordinary functions with all of the benefits of being first class values at runtime.
- futureastronaut 7y ago> Lisp without macros Why even consider that? Macros are IMO the main reason to use a LISP. As you suggested, they allow you to model laziness, or whatever else you might desire.
- chongli 7y agoBecause macros are not first class the way functions are. You can't map a macro over a list the way you can a function. Haskell functions give you the power of lisp macros at runtime. Macros are IMO the main reason to use a LISP. It's funny that you say that. I've heard it before and it sounds great but from the time I spent in the Clojure community, people would always say "the first rule of macros is that you do not write macros!"
- PopeDotNinja 7y agoDoes the Haskell compiler spit out useful concise, meaningful error messages? Compilers often have some pretty verbose output for what ended up being a (relatively insignificant feeling) typo.
- philzook 7y agoIt depends. After having gotten used to it, I can usually barely glance at an error and figure it out. I am basically satisfied with ghc errors messages, although they could be better. Sometimes it takes real head scratching. I think languages like Haskell give the compiler enough information to make insanely good error messages (At compile time mind you! Unlike python/javascript/etc). Elm apparently has some of the greatest error messages in the world. I think it is significantly better than C++ errors.
- deleted 7y ago[deleted]
- viraptor 7y agoIt's trying hard - usually it's really nice. But sometimes the amount of signature inference kills the meaning. Most of the time you get an error like A is wrong because B that comes from C. And a lot of the time it's immediately clear what the problem is. But sometimes I either don't know why would B ever get the signature it did, or why would C ever be relevant for this piece of code.
- chongli 7y agoHaskell's compiler messages can be daunting for beginners but in the hands of an experienced user they can act like a surgeon's assistant, putting the right tool in your hand without you having to go and find it. This is the magic of types and features like typed holes, for which the compiler will suggest things in scope that will fit! Haskell programming at its best starts to feel like you're putting together a jigsaw puzzle, and everything "just works" once you get it to compile.
- iamdamian 7y agoI love Haskell. But I can’t understand why record syntax is 1) completely necessary to write manageable type systems and also 2) known to be half-baked. I also wish the community was better at embracing newcomers and teaching them one step at a time. Other than that, I have no complaints.
- steve76 7y agoWhy I don't: 3. Every PC has a browser 2. You are perverts. 1. People who want to hide things on the internet (Mom's Basement not bin Laden) cause so much shit and piss in my life sometimes I feel like I'm wading through a swimming pool filled with the cement of a million toddlers! From a thousand! Police Departments! W T F T F
- viburnum 7y agoI really tried with Haskell but for me it was just impossible to refactor code without rewriting the whole program.
- Fellshard 7y agoI've been considering lately why that doesn't seem to ring quite true. I thought this for a time, then realized that a fair bit of this concern comes from lack of intuition. When you started out refactoring and making changes to object-oriented programs, how much did you have to rip out and alter each time? How did that skill improve as your designs became more thoughtful, as you began to see the seams and tailor your designs to fit those seams? I believe the same would apply for Haskell: its seams are different, but the separated concerns that come from experience and intuition should allow you to follow those seams more closely.
- chongli 7y agoHaskell takes serious effort to get used to and begin writing idiomatically. This should go without saying for most programming languages but it goes double for Haskell, because it's so different. One of the things I've come to appreciate about idiomatic Haskell is the library pattern (for lack of a better term). A properly designed Haskell project should be a library, not a monolithic program, and the problem you're trying to solve becomes a one-liner after importing your new library. A great example of this is Xmonad, which works exactly in that way.
- bgorman 7y agoUnfortunately I think it is hard to take a "Haskell is the best" article seriously with no comparison to Clojure or Ocaml. Personally I am skeptical that typeclasses + an expressive type system bring more benefits than i simple parallelism, an easy to use macro system and atoms/STM for state management. It can take programmers months to be productive in Haskell. It should only take a few days to be productive in Clojure. I think the cognitive overhead of having to deal with ADTs/Monads is too easily dismissed/disregarded.
- philzook 7y agoMy accounting of languages was not thorough. I picked very common languages and Haskell. I am also not sufficiently familiar with clojure to form judgement. I am skeptical that a language without a type system will scale in mental and project complexity well, but it might. Lisps intrigue me very much, and any language with passionate proponents is worth looking at. I am currently trying to learn OCaml and find it very nice. I think it may be more pragmatic than Haskell in many respects. Strictness is easier, grabbing mutation and side effects is easier (is it gonna hurt me later though?). I am concerned that the community feels smaller and learning resources are scarcer. I don't love the syntax (a quibble). I think it leads to less power of abstraction, either as a community aesthetic or perhaps as a language constraint. I would be perfectly content if my friends accepted OCaml. Perhaps I will change my mind and then you will find an article labelled "I (as of X) think OCaml is the best general purpose programming language" on my blog. Haskell is indeed hard.
- AdeptusAquinas 7y agoYou should have a go at F#. OCaml-like syntax, strong type system, and like Clojure sits in a large reusable ecosystem (in this case .net). Cross platform in dotnet core too.
- philzook 7y agoI have lived my life entirely outside of the .NET and Windows ecosystem, not really eager to go into it. Godspeed F# though!
- galaxyLogic 7y agoThe article makes many good points about Haskell including cons: "Very difficult learning curve. Let’s get real. Haskell is a very confusing programming language to get started in for common programming tasks." I can't avoid the comparison in my mind that Haskell is like Latin, spoken by priests, a very nice language Latin is.
- blacksqr 7y ago"The number one reason is that there is something ephemeral that I just like."
- philzook 7y agoI think this is the most honest statement in the post.
- HelloNurse 7y agoMost of the mentioned C++ issues, for instance, are also Haskell issues (in a different form).
- philzook 7y agoThey are similar in that they are both kind of big languages with many features, and a reputation for difficulty. However, Haskell's reputation is one for difficulty on how to do anything at all but once you do the angels sing, while in C++ it is difficult to do anything right. I think the positive lists diverge significantly, and I don't really think of the languages as being similar at all.
- HelloNurse 7y agoI didn't mean that C++ and Haskell are particularly similar, but that if the feature set of C++ is "huge" the even more arcane Haskell language extensions are in the same league, that legacy features that shouldn't be used in C++ are no worse than multiple half-baked incompatible libraries for the same basic purpose in Haskell, that if C++ is full of footguns Haskell is full of footgun categories, that if C++ syntax is verbose Haskell syntax is bizarre and misleading. Evidently, being in love with a programming language is an obstacle to comparing it honestly.
- philzook 7y agoIt is very, very, very difficult to be in love with a language and compare it honestly. I don't think I've ever seen anyone successfully do so. I don't agree that Haskell has as many footguns or as much legacy cruft, but if you've found that to be the case, I value your opinion.
- harry8 7y agoToday's wildly unpopular reality check for language booster-ism reminds you that there are next to no applications written in Haskell for a purpose that isn't programming a computer. When we do this exercise we can't get to double figures and nobody had a meaningful explanation as to why that is the case for a language that has been around with claims of being useful as a general purpose programming language for more than 2 decades.
- philzook 7y agoI do not have a satisfactory answer for this. But, nevertheless I want to use it. Why can't I use it? I can't get my friends on board. Have they tried Haskell and seen that it doesn't work? No. Have I had success with it? Yes. Why is there so much distrust of Haskell exactly? "Nobody else uses it. It's weird and hard." I can extrapolate this battle to one with business people with money on the line and see it falling flat a lot. But perhaps Haskell is fundamentally ill suited to applications. I hope not. Other possibilities: A language's success may be more sociological than technical, Business factors dominate, success is totally random, who got there first, holdover opinions from eras of more constrained computational resources. More answers for the same question: https://news.ycombinator.com/item?id=11907839 https://news.ycombinator.com/item?id=11907839
- harperlee 7y agoI think it is mainly sociological. Are basque, irish or croatian less useful to convey ideas than chinese or english? Not at all. Perhaps they might even be better. It doesn’t matter. What matters is who talks the language, what is written in the language, where can you be understood in the language. In programming language terms, the important questions are: do I have a library for X? Is bug Y solved quickly? How many answers do I have in stack overflow? Do I get job interviews due to that word in linkedin? Can I pair with a random valley programmer to work a quick pilot over a weekend?
- anoncake 7y agoThis is just completely irrelevant. Quality and popularity are independent concerns.
- jmull 7y agoDon’t take this too seriously. He essentially says in the intro he’s writing this to troll his developer friends. And, here’s his first reason for liking Haskell: > The number one reason is that there is something ephemeral that I just like. I am not naturally inclined to analyze such things. When I like a movie or don’t like it, it just happens, and if forced to explain why, I’ll bullshit.
- nunez 7y agoWhy does Ruby always get the shaft? It is pretty easy to learn, VERY expressive and readable, extremely easy to write tests against and works great with the web!
- pjmlp 7y agoAnd slow as a snail versus anything else.
- FranzFerdiNaN 7y agoWhich doesn’t matter for most of the programs out there.
- pjmlp 7y agoGiven that one can be productive as Ruby, and still enjoy the benefits of AOT/JIT compilation to native code, I beg to differ.
- pjmlp 7y agoProgramming languages don't live in vacuum, libraries, IDEs, supported OSes, and developer communities are also part of it. I enjoy Haskell a lot, but trying to create a CMS, desktop GUI or a console game in Haskell? Good luck with the existing tooling and libraries.
- azhenley 7y agoWhat functional language would you recommend for something like a GUI application then? I have very little experience with such languages but am always looking forward to trying one when I get a chance.
- pjmlp 7y agoThere is none that can match the tooling of Delphi, C++, .NET, Java, Swift/Objective-C for RAD UI development. Even the languages that target the JVM or CLR are not supported on the existing GUI tooling, forcing you to do workarounds. So Scala, Clojure, F# can do it, but you end up having to save JavaFX or WPF layouts, while throwing away the generated code, and load them via library calls. Or you write the UI layer in Java/C#/VB.NET/C++, while writing the rest as a library. So at the end of the day you are forced to chose between RAD productivity or FP purity. EDIT: I have naturally forgot Common Lisp, but for that you should make use of Allegro or LispWorks, not Emacs + FOSS Lisp compiler.
- dudul 7y ago"functional programming is weirder than imperative programming." Honestly, it's hard for me to take seriously any post/comment including this.
- kadblas 7y agoQualification: I was introduced to FP a number of years ago and have finally reached a point where I feel that I have a deep understanding of FP in general. In my mind, Haskell is the "best" language out there ("best" in that it provides the best overall gain when all tradeoffs are considered). I'm no longer confident that Haskell is the "best" language anymore. I was recently introduced to a language that might be even better than Haskell: Dyalog APL. (https://www.dyalog.com/ https://www.dyalog.com/). Try it out yourself (https://tryapl.org/ https://tryapl.org/) To explain why, I recommend watching Aaron Hsu's videos on Dyalog APL: - Does APL need a Type System? (https://www.youtube.com/watch?v=z8MVKianh54 https://www.youtube.com/watch?v=z8MVKianh54) - This is actually a very interesting question that is more nuanced than upon first glance. - Design Patterns and Anti-Patterns in APL (https://www.youtube.com/watch?v=v7Mt0GYHU9A https://www.youtube.com/watch?v=v7Mt0GYHU9A) - The main takeaway from this video for me was the principle of "Idioms over libraries." - Higher Performance Tree-Wrangling, the APL way (https://www.youtube.com/watch?v=hzPd3umu78g https://www.youtube.com/watch?v=hzPd3umu78g) - Or how to model Trees without using pointers by using "Inverted Tables." (An inverted table is a table where the columns are the rows and the rows are the columns)