Live data from Hacker News

I tried Haskell for 5 years

metarabbit.wordpress.com

111–120 of 273 posts

Re: I tried Haskell for 5 years

#111
post #59

Earlier quoted context omitted.

I just saw a haskell meetup where they're using haskell for devops. Basically static typing the underlying machine configurations. As usual, being an Haskell code, the abstraction is generalized and you can apply the logic on other domains.

Was it https://fugue.co ? I think they use Haskell for their DSL

here's the list of libs mentioned https://news.ycombinator.com/item?id=14267364

Re: I tried Haskell for 5 years

#112
post #69

Earlier quoted context omitted.

Here's a practical application of mfix: mfix $ \threadId -> forkIO $ do -- computation in forked thread forkIO creates a new thread and returns its thread id. However, in order to access the returned thread id inside the forked computation, normally one would have to store it in a variable and then read from it inside the thread. mfix, by nature of its laziness, captures the return value of the function passed to it,…

It's a very neat example, and I like it very much as an illustration of mfix, but wouldn't one just use Control.Concurrent.myThreadId for that? Seems a little overkill.

Ha, I guess this must be some kind of selective blindness then :) I've seen myThreadId many times, it makes perfect sense, and yet, whenever I've had to grab the spawned thread id I've always reached for mfix... Well, in this particular case there's of course no need for that.

But the general pattern applies to many things. One other example that immediately springs to mind is e.g. registering a callback while needing the ability to unregister the callback from within itself, using some sort of id returned from the registering function.

Re: I tried Haskell for 5 years

#113
post #89

Earlier quoted context omitted.

> The cool thing about OCaml is that you can actually reason about performance, as long as you ignore memory issues (memory usage, garbage collector runs, etc.). If you ignore mem issues you can also reason about the performance of Haskell :) If we want to reason about perf, I think Rust is currently leading in terms of a modern language that allows perf reasoning.

> If you ignore mem issues you can also reason about the performance of Haskell :) Really? My guess (based on close to complete ignorance) would be that laziness would make reasoning about performance hard. Can you ELI5 why my guess is wrong?

> laziness would make reasoning about performance hard

Because of it potentially hogging memory! Now we were told to ignore mem issues by the commenter. I just point out the contradiction.

Re: I tried Haskell for 5 years

#114

Earlier quoted context omitted.

> (#1) Time and experience can cover up anything. This is simply not true. Time and experience can never cover up for lack of expressiveness, and expressiveness is one of the biggest selling points of Haskell. In fact, experience can only cover for complexity, and lack of discoverability or intuitiveness. Haskell has all those three flaws, so you see, experience is really needed. > (#2) So does NodeJS and (on an abst…

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

haskell is objectively expressive. (where expressive means amount of logic per character)

there are multiple reasons for this, kind've tied together. Whitespace is function application (no parenthesis to keep track of like lisp, or even e.g. c, java, or javascript, when programming in a functional style). Immutability forces you to compartmentalize and compose everything. when everything is a function, function and variable names serve as VERY powerful documentation, especially when combined with haskell's also VERY powerful type system (which e.g. has sum types where most languages do not, which allows for example, defining most error states of program as a data type (which can then derive from any typeclass)).

one of the primary benefits of laziness is to make function composition possible under a wider variety of situations (which also increases expressiveness, at the cost of occasional though not difficult to avoid space leaks)

one joke I've heard is that the ideal haskell program is 20 lines of imports and one line of perl.

Re: I tried Haskell for 5 years

#115

Earlier quoted context omitted.

OP here. The point about a learning curve is that Haskell is different from most mainstream programming languages. > > 2. Haskell has some very nice libraries > So does NodeJS and (on an abstract level) Microsoft Word. > Libraries are infrastructures and investments that (like > time and experience) can cover up any shortcomings. Javascript is one of the most widely used languages in the world and MS Word leverages t…

So you understand I was commenting that your post didn't really say much about Haskell (learning curve, libraries, tooling ). What you commented or implied is a bit of current Haskell culture. > I actually like C++ a lot. Haskell is an example of academic carefully crafted language, while C++ is rather a practically driven continuous patchwork (and they are extremities to both ends). I simply find your comparisons od…

> Haskell is an example of academic carefully crafted language, while C++ is rather a practically driven continuous patchwork (and they are extremities to both ends).

Haskell is also a continuous patchwork, just look at the number of deprecated GHC extensions.

Re: I tried Haskell for 5 years

#116
post #96

Earlier quoted context omitted.

> ... I am a bit lost Google "cognitive dissonance" and the "sunk cost fallacy."

The point of the article was focusing on things to fix. Having used Haskell, there's a great many things that were worth the cost of learning it. For one thing, it's made me a vastly better programmer in other languages. It lets me appreciate better styles of writing code and think outside the box when solving things. Using Haskell also gives me the tools for many projects to write code almost thoughtlessly -- you ca…

> you can just start writing in a declarative style and not worry about debugging, because everything is checked by the type system

That is dangerously close to the infamous "if it compiles, then it works" boast, which Haskellers make all the time (while denying that they make it), demonstrating in the process that they don't write real software, where the defects one encounters are very often of a nature such that the program behaves exactly as intended by its authors, but the intended behavior is itself wrong. How does the type system help here?

My comment wasn't glib. I actually think those phenomena quite well explain much Haskell advocacy. Considering how massive an undertaking it is to learn the language and its Byzantinely-complex, PhD-theses-in-disguise libraries (each of which sports a zoo of custom operators) and how small the payoff is, it's unsurprising that those who take the plunge begin zealously encouraging others to do the same, lest their own investment have been for nothing. In a way it's like a conspiracy.

Re: I tried Haskell for 5 years

#117
post #89

Earlier quoted context omitted.

> The cool thing about OCaml is that you can actually reason about performance, as long as you ignore memory issues (memory usage, garbage collector runs, etc.). If you ignore mem issues you can also reason about the performance of Haskell :) If we want to reason about perf, I think Rust is currently leading in terms of a modern language that allows perf reasoning.

> If you ignore mem issues you can also reason about the performance of Haskell :) Really? My guess (based on close to complete ignorance) would be that laziness would make reasoning about performance hard. Can you ELI5 why my guess is wrong?

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 than the performance impact of interpreting code, which is something many people consider completely acceptable.

Re: I tried Haskell for 5 years

#118
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 is good for problems where you want to spend most of your time thinking in terms of the problem domain and not so much about all the little implementation details.

For instance, if you were to write a CAD program, you probable want to be spending your time thinking about algebra and geometry, and not about little details like how an array is laid out in memory or when memory needs to be freed. The latter might be important for optimizing the last bit of performance out of a tight loop, but a lot of problems are hard enough on their own that just coming up with any solution that works is enough trouble on its own.

It's also good for problems where you want pretty good performance but don't have to be as fast as C, or where you want to take advantage of multi-core parallelism but don't want to deal with the usual complexities of threaded code.

Persistent data structures are really nice for certain kinds of applications, such as web services, where you have some complex internal state that needs to be updated periodically. Error handling is really easy when you can just bail out when something fails, since none of the state was ever modified-in-place and your old pointer to the old state is still valid.

The powerful static type checker makes Haskell a good fit for applications where it's really important that you calculate the right answer, or where you don't want to spend much time tracking down weird bugs.

Haskell isn't so good at applications where you need hard real-time guarantees or you want to have very fine control over the memory layout of your data structures or you want to be able to easily predict CPU or memory usage.

Re: I tried Haskell for 5 years

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

I am not an expert in any way, but parsers seem suited to Haskell. Perl 6's original parser was build using Haskell I believe and went on to influence the language a lot (again this is all stuff i have read, I have no real practical experience with either Perl 6 or Haskell).

Re: I tried Haskell for 5 years

#120
post #41

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

> and where trivial problems are the subject of ongoing academic research Like what?

I am not holding that (joke's) view, but monad came to mind as an ongoing academic research (to original Haskell at least) in order to solve a rather trivial stateful programming (trivial in an imperative style). To generalize that example, there are solutions that are trivial to express in an imperative style but seems convoluted in pure functional programming. How to retain the trivialness are subject of ongoing academic research.

EDIT: To be specific, I can think about the example of machine efficiency that can simply be specified literally in C but it is uncertain and opaque in Haskell.

Post reply on HN