Live data from Hacker News

I tried Haskell for 5 years

metarabbit.wordpress.com

161–170 of 273 posts

Re: I tried Haskell for 5 years

#161

Earlier quoted context omitted.

All performance issues caused by laziness are memory issues. Something isn't evaluated promptly, so large amounts of memory are consumed storing unevaluated expressions. This causes drag on the garbage collector and excess cache thrashing when it finally is evaluated. But all of that is just because data stays in memory longer than expected. If you ignore that, laziness has a small performance impact, but it's less t…

Both you and cies said that "All performance issues caused by laziness are memory issues." My intuitive sense was more like: You've got a lazy calculation that has several stages. At some point in the pipeline, you're doing something slow, but it's not obvious. When you get to the end and start using the data, the whole calculation is slow. But it's not clear where it's slow, because of the laziness. That may not be…

That happens sometimes, but the solution is the same as in a strict language. Break out the profiler and see what's taking all the time. There's a learning curve while you figure out what the usual suspects are, but usually you can find things pretty quickly afterwards.

Profiling is a bit of a black art in any case. I've seen horrible performance problems in python when we added enough code to cause cache thrashing to a loop. No new code was slow, but the size of it crossed a threshold and things got suddenly bad.

Some performance problems in Haskell are hard to track down, but most are pretty easy to find and fix. It's basically the same as every other language in that way.

Re: I tried Haskell for 5 years

#162

Earlier quoted context omitted.

Haskell has a preference for looking academic, and is one of the favorites on academic circles. But that does not mean it's not used within industry. I'd say that people mostly do not know what is running in industry. It could be any share of anything. We get a hint looking at job offers; Haskell is small there, but not unheard of. On the sweet spot, Haskell is great for modeling complex domains; it's great for long-…

>> I'd say that people mostly do not know what is running in industry well if anyone does know what's out there then HN crowd would be a pretty good suspect in that regard. I personally have done my fair share of consulting and prof services engagements - dozens of them across all kinds of industries - I've never seen a Haskell shop. Java, Python, JS, Golang, Scala, Clojure, .Net, C, PHP - definitely out there in the…

Your experience may be biased. If I had a shop that depended on external consultants for development, I'd avoid any language that I'm not certain to be mainstream. It's just too risky.

Re: I tried Haskell for 5 years

#163

I will never, ever use Haskell in production because of its default evaluation strategy, the wrongness of which was tacitly conceded not long ago with the addition of the strictness pragma (which only works per-module) to GHC. I think it's especially telling that its community skews so heavily towards this blogger/monad tutorial writer dilettante demographic rather than the D. Richard Hipp/Walter Bright 'actually get…

> you'd expect to see high-quality operating system kernels

The Haskell community is smaller than others but there are numerous highquality projects, including kernel/OS level projects that you don't mention:

HaLVM, Haskell Unikernels - https://github.com/GaloisInc/HaLVM

The specification model of the sel4 microkernel - https://github.com/seL4/l4v/tree/master/spec/haskell

There are many smaller examples of OS projects in Haskell, but for better examples of production systems you only have to look to areas requiring high assurance such as finance, where a number of large companies use Haskell and other functional languages. (BoA, Barclays, Credit Suisse, Standard Chartered, etc.)

It's true that there a lot of Haskell blogs focused on research level Category theory, but the concepts there don't need to be used or understood for high quality, production ready code. I'm actually not a Haskell guy, and very much of the mindset that you should use the right tool for the job, but being dismissive of languages with unique features such as being lazy by default is shortsighted.

Re: I tried Haskell for 5 years

#164
post #74

We have a code base of roughly 200,000 lines of Haskell code, dealing with high performance SQL query parsing, compilation and optimizations. I only remember one situation over the past 5 years that we had a performance issue with Haskell, that was solved by using the profiling capabilities of GHC. I disagree that performance is hard to figure out. It could be better, yes - but it's not that different than what you'd…

but it's not that different than what you'd get with other programming languages. Until you have to solve a (maddeningly common) space leak issue. That's a problem unique to lazily evaluated languages (basically Haskell) and is godawful to debug. It reminds me of solving git problems... you suddenly find yourself having to tear back the abstraction layer that is the language and compiler and start thinking about thun…

There is this really great paper about space leaks and arrows: https://pdfs.semanticscholar.org/cab9/4da6e4b88b01848747df82...

Re: I tried Haskell for 5 years

#165

I will never, ever use Haskell in production because of its default evaluation strategy, the wrongness of which was tacitly conceded not long ago with the addition of the strictness pragma (which only works per-module) to GHC. I think it's especially telling that its community skews so heavily towards this blogger/monad tutorial writer dilettante demographic rather than the D. Richard Hipp/Walter Bright 'actually get…

Would you also feel that a strict-by-default language which adds support for lazyness is a tacit admission that strict-by-default is wrong?

In C# or Java, it's easy to get a lazy collection and force it into a list or an array. Is it possible to do the same with haskells (lazy) lists?

Re: I tried Haskell for 5 years

#166

Earlier quoted context omitted.

> Time and experience can never cover up for lack of expressiveness Expressiveness is subjective. Experience can alter one's perception. In fact, time and experience alter the basis of comparisons, from objective comparisons to subjective comparisons. > No, they don't. Javascript and macro Basic do not even have enough expressiveness for supporting the kind of library you'll find in Haskell. You mean you can express…

Expressiveness is a objective term, although it's multidimensional. It's the number of different concepts you can express in a language without writing an interpreter¹. Anyway, the dimensionality isn't much of a problem on that comparison since Haskell has the upper hand in an overwhelming number of dimensions. Keep in mind that Javascript required a multi-year process in what a committee reached an agreement and all…

> but "subjective" is not the same as "meaningless", even less when nearly everybody that experienced it has the same assessment.

Subjective on its own don't have to be meaningless. It can be subjectively meaningful. However, use a subjective statement to pass as an objective support, that is meaningless. So if OP and you are merely commenting on the status of mind or his and yours, that is fine -- and I do learn something in that regard. OP, and several other commenters, did not seem to realize they are substituting their (personal) subjective opinion to objective reasoning, that was what I pointed out, in case it become useful (to them).

Re: I tried Haskell for 5 years

#167
post #103
post #16

Question to the Haskell experts here. Is Haskell more academic in nature or used heavily in Production environments? Is there an application sweet spot/domain (say Artificial Intelligence/Machine Learning, etc) where it shines over using other languages (I am not talking about software/language architectural issues like type systems or such)? I have no experience with Haskell but do use functional languages such as E…

We're using Haskell to produce an entire compute platform for building, composing, and running type-safe containerised micro-services for data science. This certainly touches on a lot of the areas that Haskell is traditionally known for being good at, e.g. building DSLs, type systems, interpreters, etc. However, the work also includes a runtime platform that is more low-level, including building our own container sys…

This work might give you some ideas even though it's a bit dated:

http://programatica.cs.pdx.edu/House/

Also, COGENT for lowest-level stuff being wrapped for use in Haskell somehow might be interesting. Used on ext2 filesystem already.

https://ts.data61.csiro.au/projects/TS/cogent.pml

Re: I tried Haskell for 5 years

#168
post #151
post #41

Haskell: where difficult problems are trivial, and where trivial problems are the subject of ongoing academic research

The Sieve of Eratosthenes is a good example of relatively trivial in imperative code but a research paper in Haskell.

I am pretty sure the sieve can be written like this in Haskell, which might be a bit short for a research paper:

    sieve :: Integral a => a -> [a]
    sieve l =
        sieve' [2..l] []
      where
        sieve' (p:ns) ps =
        sieve' (filter (\x -> rem x p /= 0) ns) (p : ps)
        sieve' [] ps =
            reverse ps

Re: I tried Haskell for 5 years

#169
post #16

Question to the Haskell experts here. Is Haskell more academic in nature or used heavily in Production environments? Is there an application sweet spot/domain (say Artificial Intelligence/Machine Learning, etc) where it shines over using other languages (I am not talking about software/language architectural issues like type systems or such)? I have no experience with Haskell but do use functional languages such as E…

Haskell has a preference for looking academic, and is one of the favorites on academic circles. But that does not mean it's not used within industry. I'd say that people mostly do not know what is running in industry. It could be any share of anything. We get a hint looking at job offers; Haskell is small there, but not unheard of. On the sweet spot, Haskell is great for modeling complex domains; it's great for long-…

> and is one of the favorites on academic circles.

I'd argue Python is much more prevalent with researchers than Haskell.

Re: I tried Haskell for 5 years

#170

Earlier quoted context omitted.

By objective, you mean succinctness (which can be simply measured by program character counts)? In this regard, APL must be the most objectively expressive language. What if we run deflation over APL? It happens that I measure expressiveness by the amount of the time the author takes to express an idea and/or the amount of the time the reviewer takes to comprehend an idea. That, unfortunately, is very subjective. APL…

Well I can't argue with the contention that there's a level of subjectivity here. However your definition of expressiveness is most likely positively correlated with the one I provided; furthermore, while you may be able to more quickly "express an idea" in a dynamically typed language, your ability to precisely enumerate the idea will be less than a statically typed one. I've been writing haskell for only several mo…

> furthermore, while you may be able to more quickly "express an idea" in a dynamically typed language, your ability to precisely enumerate the idea will be less than a statically typed one.

What we need realize is not all ideas are precise. In fact, most of our ideas are vague to certain extent. They are still OK as long as the vagueness does not matter to the problem of interest or it is already constrained or implied in the context. So to efficiently express an idea, both insufficiency or over specificness are negative to expressiveness. To disclaim, I don't claim any language is the best to that regard. I believe language should be suited to the problem (as well as the experience of the team).

Since you particullarly mentioned type, I would suggest that not always a particular type is important in a idea. For example, sorting, the types of the items are not intrinsic in the idea. Having to specify the type contributes negatively to the expressiveness. However, when performance is concerned ragarding to certain specific sorting problem, types (as narrowly specific as we can) are of importance. However, we should recognize that is a different idea from the original idea of sorting. So even though in the program eventually it expresses both the algorithm for sorting as well as the types, being forced to mix ideas are negative toward expressiveness.

Haskell, its types and pureness, for example, are not always essential in a programming idea. Having to take care of these language requirement while it is non-essential, makes it less expressive (in those problem domain).

Post reply on HN