4 ms·
As to Haskell's syntax, I think it's really just as complicated as it needs to be to express the ideas Haskell embodies succinctly and precisely. It doesn't hav
by thinkpad20 13y ago
As to Haskell's syntax, I think it's really just as complicated as it needs to be to express the ideas Haskell embodies succinctly and precisely. It doesn't have any more syntax than most other languages; it's just a very different syntax than most non-functional languages. And this is precisely because the semantics of the language are also very different. Haskell, for example, is not block-structured, as nearly all imperative languages are. (It does simulate this with do-syntax, but this is only a simulation). I understand though - I find Clojure practically unreadable, and this has kept me away from it to a degree.
As to where Haskell fits: you're correct, there are many other great languages out there. But I think Haskell is really unique in offering what it does. Clojure, Go, and Erlang are all great in their own regard, but none of them provides the degree of safety that Haskell does. For example, none of them enforce purity, and all three of them freely allow the use of `null` values (which is really quite surprising considering how many problems nulls cause). Clojure and Erlang avoid mutable state like Haskell does (though not to the same degree of rigor) but don't provide the elegant solutions for simulating mutable state that Haskell does with its monads, which almost allow you to "have your cake and eat it too" with state. None of them encourage the degree of abstraction that you'll find in Haskell. Also, at least according to the Computer Benchmark game, Haskell beats all three of them in terms of speed, as well. Haskell's "place" is in generating highly robust code with good performance, and also works as a beautiful language for expressing certain mathematical concepts.
This doesn't make Haskell a perfect language, but it absolutely has a lot to offer that other languages don't. And it's so much different than other languages, that at the very least it can change your perspective on a lot of things.
- platz 13y agoI think one has to be careful about performance claims. Of course you can tweak things to be fast in hakell, but to be able to actually program haskell in such a way to, beat other languages in performance, is not a trivial skill. There are numerous stackoverflow and r/haskell posts "Why is my haskell code 10x times slower than language X?" Or observe this set of web framework benchmarks: http://www.techempower.com/benchmarks/ http://www.techempower.com/benchmarks/
- thinkpad20 13y agoThat good performance is not trivial to achieve is not really here nor there. Haskell is a difficult language and many people come into it with assumptions that come from imperative or strict languages and don't hold up in a lazy functional language. That there are programmers who are using the language in a non-optimal way, and coming away with reduced performance, is not a mark against the language itself. To the extent that the benchmarks prove anything, they prove that you can write Haskell code to be competitive with or any other language, at least in regards to those specific problems. Of course, it certainly doesn't prove that there are no areas in which Haskell - as a language, not in regards to specific uses - is not in the upper level of performance. As to the web frameworks benchmarks, I can't speak to them, as I don't know whether they were written expertly or with the latest available libraries. Maybe they aren't as fast. Regardless, it's clear that it's more than possible to write very performant code in Haskell, so ruling it out on those grounds makes little sense.
- platz 13y agoI don't think I made a mark against the language itself, or tried to rule it out, or tried to indicate it cannot attain the highest levels of performance - Yes, my point was just that there are programmers using Haskell in a non-optimal way. Beginners seem to be surprised when their Haskell code isn't automatically in the upper level. I'm not really a great fan of benchmarks, or this particular benchmark, but at least the source of every test is available: https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/wai/bench/wai.hs https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast... https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/snap/bench/src/Main.hs https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast... https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/yesod/bench/src/yesod.hs https://github.com/TechEmpower/FrameworkBenchmarks/blob/mast...
- igouy 13y ago> at least the source of every test is available Also true of the benchmarks game. (Also the command line used to compile and run the program, etc)
- igouy 13y agoAccording to the benchmarks game, one has to be careful about performance claims :-) http://benchmarksgame.alioth.debian.org/dont-jump-to-conclusions.php http://benchmarksgame.alioth.debian.org/dont-jump-to-conclus...