5 ms·
Who says Haskell is so great? What does "better" even mean?
by acchow 10y ago
Who says Haskell is so great? What does "better" even mean?
- allengeorge 10y agoFrom what I've inferred from the article "better" means: easier to write large-scale, composable systems that engineers can reason about easily.
- _yosefk 10y agoIt doesn't seem easy to reason about the performance of a program under lazy evaluation. Generally there are many aspects of a system that you may want to reason about, and making it easier to reason about one often comes at the expense of making it harder to reason about another. Pure functional code, for example, makes it easy to reason about what outputs are produced from what inputs, but that is one (important) aspect among many (and to take one thing that's really simple without purity and really tough with it - consider "pure functional data structures" vs data structures in imperative languages assuming a mutable RAM.)
- solidsnack9000 10y agoLaziness is a real problem for reasoning. Reasoning about pure functional data structures in the absence of laziness isn't that difficult, any more than the many mutable data structures that have copying/rebuilding/rebalancing that takes place only sometimes. The benefit of pure functional data structures is most visible when there is some kind of sharing -- concurrency of some kind -- in which case, reasoning about side effects becomes more difficult. There are good approaches to handling in-place array update and similar operations in pure functional programming (the ST monad, for example), it's just not the default. As long as the side effect is somehow accounted for in the return value, referential transparency is maintained; we might say the return value is there to help us reason about side effects.
- ExpiredLink 10y agoA higher peak in the hype cycle.
- solidsnack9000 10y agoThe article is posing a question to those who believe Haskell is great. "Assume for the sake of argument that Haskell is great...then why hasn't it taken over the world?" Anecdotally, I can't think of a case of someone who's used Haskell with proficiency and feels another language is generally better. But I can think of many cases of people who, confronted with the learning curve, set it aside to learn something else more immediately applicable. Just looking at some bullet points, Haskell offers: * A nice interpreter, * Default immutability, * A flexible and clear type system. Default immutability does make reasoning about your program much easier. I don't think anyone would argue that but if you disagree it'd be interesting to hear what you have to say. The absence of an interpreter in Go is a major nuisance, and makes it about as difficult as Rust to try out something simple. Whether you like the type system of Haskell or not, it is pretty good for the kind of type system it is. There is a joke that Haskell libraries don't have any documentation and when people complain the Haskellers say, the types are enough. At a certain point you realize this is true: you get a lot more out of a Haskell type signature than a Java or C type signature, so much so that your approach to a library is generally "I'm looking for a function A -> B..." and you fish around by type. This is the dream of types: meaningful, machine-checked metadata.