Live data from Hacker News

I tried Haskell for 5 years

metarabbit.wordpress.com

221–230 of 273 posts

Re: I tried Haskell for 5 years

#221
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…

(OP here) I do say it's not that big of a deal in the end: it almost always is OK and at the end you optimize the inner loops by looking at profiles; like in any other project. But when using GHC, I have indeed sometimes ran into situations where I expect something to be fast when it is not (e.g., `ByteString.map (+ value)` is incredibly slow compared to a pseudo-C loop). I also did find a bona fides performance bug…

> (e.g., `ByteString.map (+ value)` is incredibly slow compared to a pseudo-C loop).

That situation sounds like you needed a ByteString Builder to get comparable performance.

Re: I tried Haskell for 5 years

#222
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…

Any particular reason you're building your own container system instead of leveraging LXC or Docker?

For the massively parallel workloads you find in data science, it seems like you'd benefit a lot from the wealth of container orchestration tools around Docker (swarm, Rancher/Cattle, Kubernetes) in order to easily scale out your functions. Especially when many companies already have these set up for their more vanilla applications.

This is an example I've seen that can leverage a docker swarm for invoking functions, loosely modeled after AWS Lambda: https://github.com/alexellis/faas

Re: I tried Haskell for 5 years

#223

> If you read an article from 10 years ago about the best way to do something in the language, that article is probably outdated by two generations. Thank you, that is all I need to know about Haskell. I won't be learning Haskell then, in the same way that I won't have anything to do with C++. I don't have enough time to use these fashion-dominated and fad-obsessed programming languages.

Holy cow! Don't ever dream about getting into node.js then!

Anything to do with Javascript is prey to churn. Many modern web pages consist of a blank page which loads various bits of Javascript from various servers which then process other Javascript via Javascript templates into the final page. There might be a small minority of web sites which actually are updated so often that these actions are justified, but the bulk of the websites clearly are those where some Javascript-fixated person has decided that "there is no such thing as too much Javascript".

Considering that the language was not very well designed in the first place, putting it on both the web browser and the server, and then insisting on regenerating what could easily have been supplied as static HTML pages by running dozens of Javascripts on both the server and the browser should be enough to convince an average observer that Javascript is being abused in this way due to nothing more than faddism.

Re: I tried Haskell for 5 years

#224

Earlier quoted context omitted.

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…

> unique to lazily evaluated languages More precisely, unique to significant use of laziness, which is going to (obviously) be more common in lazily evaluated languages but laziness is supported elsewhere.

[deleted]

Re: I tried Haskell for 5 years

#225
post #107

Earlier quoted context omitted.

Maybe something like: class Foldable myFoldable where foldl :: (summary -> element -> summary) -> summary -> myFoldable element -> summary This is the translation I do in my head when I read that type signature, at least.

I wonder if anyone has worked on a Prelude replacement which has these replacements (along with renaming functions where appropriate)...

To change the names you'd have to re-implement all the functions. Good luck with that, base is /large/.

This is a documentation issue, not an implementation issue.

Re: I tried Haskell for 5 years

#226

> If you read an article from 10 years ago about the best way to do something in the language, that article is probably outdated by two generations. Thank you, that is all I need to know about Haskell. I won't be learning Haskell then, in the same way that I won't have anything to do with C++. I don't have enough time to use these fashion-dominated and fad-obsessed programming languages.

Surely you’re joking? I think ~5 years is a totally reasonable time frame for new techniques, language features, and best practices to come about. Languages and libraries evolve in response to the needs of users and pain points with older approaches.

To be honest, having been a Haskeller since ~2010 (and a C++ guy since long before that) I’m not even really sure what specifically the author is referring to there.

Re: I tried Haskell for 5 years

#227
post #12

> very hard to understand why a function could be useful in the first place So true. https://hackage.haskell.org/package/base-4.9.1.0/docs/Contro... > mfix :: (a -> m a) -> m a > The fixed point of a monadic computation. mfix f executes the action f only once, with the eventual output fed back as the input. Hence f should not be strict, for then mfix f would diverge. But why tho?

mfix is somewhat low-level. It’s used in the desugaring of Haskell’s “do rec” notation. I find it useful because it lets me take a recursive structure[1] and a multi-pass algorithm[2] on that structure, which involves side effects[3], and express it in code as a single pass, without mutation. This conversion of multi-pass algorithms to a single pass while retaining time/space complexity guarantees is one of the key b…

I'd love to hear more detail about the example you give of type inference over an AST. I like the idea, but I'm having trouble envisioning how to write code in that style cleanly. Did you implement that in an open source project I could take a look at?

Re: I tried Haskell for 5 years

#228
post #24
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…

Application sweet spot is a funny thing, because it's mostly determined by the presence of specific libraries. What Haskell has more than anything is ridiculously general libraries. It's got perfectly good libraries for web development, Postgres access &access, but the only place I'd say it's got a real application-specific strength in libraries is parsing. Weirdly, what Haskell is good at is generality. Which is muc…

One of the main reasons Haskell isn't used more in production systems is the small pool of developers that can actually program in it.

It is a very good language once the type system makes sense and you can reliably reason about the lazy nature of it.

Re: I tried Haskell for 5 years

#229
post #196
post #50

Earlier quoted context omitted.

> The line that if it compiles, it’s probably correct is often true. That is the meat of why Haskell is so great. I've never so reckless refactored code as much as I do in Haskell, I just wait for the compiler to tell me what I missed and go back and fix it up. I'd never do that in C, C++, Java, etc; it'd be suicide. And while that's still not a great fleshed out explanation, it's a great oversimplification of the sy…

> I've never so reckless refactored code as much as I do in Haskell, I just wait for the compiler to tell me what I missed and go back and fix it up. I'd never do that in C, C++, Java, etc; it'd be suicide. That's precisely what I was doing at work today in a C# project. I was going particularly crazy today, doing some refactoring with project wide regex replaces rather than leaning on VS/Resharper for everything. I…

Yup, C# codebases (especially w/ tools like Resharper) can be massively refactored and, in my experience, almost always work perfectly as long as there are no compilation errors. C# tooling is fantastic.

Re: I tried Haskell for 5 years

#230
post #176
post #168

Earlier quoted context omitted.

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

That's not the real sieve, though. It doesn't cross off pre-visited primes and is incredibly inefficient. Try finding just the 19th prime. Here is the paper on the real sieve, https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf

And it's exactly the same thing with the classical beautiful functional example of quicksort. It's not actually quicksort and its performance is awful as a result.

Haskell has trade offs.

Post reply on HN