Live data from Hacker News

Why does Haskell, in your opinion, suck?

reddit.com

191–200 of 208 posts

Re: Why does Haskell, in your opinion, suck?

#191
post #186
post #184

Earlier quoted context omitted.

But Haskell pure functions do "block" when they request memory from the allocator, for example. How do you distinguish these two kinds of blocking so you can claim that OCaml has it and Haskell doesn't.

In the sense that this blocking can be fully or partially reified. I don't know much about OCaml's implementation of their lwt library, so I'll give an example from Java: In Java you can create a thread running a single subroutine, have that block by calling `park`, and then hold on to that blocked function in a form of a reified object (the thread), which you can resume at any time. This is not possible in Haskell,…

> This is not possible in Haskell, you cannot hold onto blocked subroutines (i.e. continuations); instead, you hold onto a chain of functions connected via a monad (or monads).

I don't understand what this means, and I certainly don't understand the difference between the two things.

Re: Why does Haskell, in your opinion, suck?

#192
post #172
post #166

Earlier quoted context omitted.

How big were such projects? I never saw a C project with teams bigger than 5 developers without memory corruption issues.

Hundreds of thousands of LOCs. ~15 developers I didn't say there were no corruption issues. Just that they're rare and a very small minority of the time is spent chasing them. In return, get determinism and optimality of execution.

Once I spent one week tracking down a memory corruption issue introduced by someone on the team and deployed into production.

Got a very interesting week tracking down that issue, while getting regular customer calls when the problem would be sorted out.

I surely don't miss it.

Re: Why does Haskell, in your opinion, suck?

#193
post #192
post #172

Earlier quoted context omitted.

Hundreds of thousands of LOCs. ~15 developers I didn't say there were no corruption issues. Just that they're rare and a very small minority of the time is spent chasing them. In return, get determinism and optimality of execution.

Once I spent one week tracking down a memory corruption issue introduced by someone on the team and deployed into production. Got a very interesting week tracking down that issue, while getting regular customer calls when the problem would be sorted out. I surely don't miss it.

I think in ~10 years of C development, I had seen maybe 1 corruption bug slip through the testing suites to production. The vast majority are caught in unit tests, system tests, or QA.

I think it took 2-3 days of a 2-3 devs, but that's mostly because any production bug was very very expensive (Need to be very careful not to damage production machines).

But the search for the corruption was usually a couple of hours, perhaps a day's project.

If you utilize tools like valgrind, poison data that is released to pools, follow strict coding conventions, heavily test-cover your code, and become gdb-savvy, corruption bugs become not that expensive.

Re: Why does Haskell, in your opinion, suck?

#194

Earlier quoted context omitted.

How can wolf fencing work on unsorted if you have to find out where it happens? Wouldnt that involve iterating on each item to find out where the wolf is?

Binary search is looking for a value. Wolf-fencing is looking for a side-effect of that value. As per analogy, you're not checking an animal in Alaska to see if it is a wolf, you are waiting till the wolf howls (side effect of wolf-existence) then focusing your efforts in that area. So you can't really use wolf-fencing to say... find a number in an array; it makes no sense.

I like this explanation ;)

So apply a binary search to an effect instead of a value.

Re: Why does Haskell, in your opinion, suck?

#195
post #193
post #192

Earlier quoted context omitted.

Once I spent one week tracking down a memory corruption issue introduced by someone on the team and deployed into production. Got a very interesting week tracking down that issue, while getting regular customer calls when the problem would be sorted out. I surely don't miss it.

I think in ~10 years of C development, I had seen maybe 1 corruption bug slip through the testing suites to production. The vast majority are caught in unit tests, system tests, or QA. I think it took 2-3 days of a 2-3 devs, but that's mostly because any production bug was very very expensive (Need to be very careful not to damage production machines). But the search for the corruption was usually a couple of hours,…

> If you utilize tools like valgrind, poison data that is released to pools, follow strict coding conventions, heavily test-cover your code, and become gdb-savvy, corruption bugs become not that expensive.

Watch Herb Sutter's CppCon 2015 presentation.

Apparently among the top of C++ developers that managed a ticket to get there, only 1% of the audience uses such tools.

Re: Why does Haskell, in your opinion, suck?

#196
post #89

Haskell sucks because you can't really get anywhere before understanding monads well, and monads are (take your pick) a) too hard for most programmers, or b) too distant from the abstractions used in most programming languages. Not that's you're done mastering Haskell when you've figured out monads, of course. There are plenty of harder abstractions running around. But monads are the orgo of Haskell, the place many e…

Most people writing Haskell code for real problems should never write their own instances of Monad. When you see someone implementing tons of instances of Monad, it's a sign of over-engineering and Haskell masturbation. Very, very few people are good enough to judiciously understand when and where to write their own instances. In the majority of cases you should merely be using instances of Monad which solve extremel…

> Most people writing Haskell code for real problems should never write their own instances of Monad.

Does using Free count? ;)

Re: Why does Haskell, in your opinion, suck?

#197
post #190
post #185

Earlier quoted context omitted.

> I would love to see PFP as a drawback and obtain its benefits without requiring its rigors. > (One of) the real-world benefit(s) is that I can write a substantial part of a program and know from inspecting only a single line (its type signature) what effects it performs. How can OCaml give me that benefit? That's a property, not a real-world benefit. It's like saying that one of the real-world benefits of Haskell i…

Firstly, and briefly, I don't agree with your approach to epistomology. I think we're never going to agree there. Let's just agree to be mutally antagonistic on that front so we can get to the important issue, which is improving software development. Secondly, I'm interested in general purpose programming, so as useful and interesting as your explanation of synchronous languages and TLA+ are, they are not relevant to…

> I'm interested in general purpose programming, so as useful and interesting as your explanation of synchronous languages and TLA+ are, they are not relevant to me.

There's nothing non-general-purpose in that approach. See, e.g., the front-end language Céu[1], by the group behind Lua (I think). The short video tutorial on Céu's homepage can give you a good sense of the ideas involved (esp. with regards to effects), and their very general applicability. I find that just as the functional approach is natural for data transformation, the synchronous approach is natural for composing control structures and interaction with external events. I think it's interesting to contrast that language with Elm, that targets the same domain, but uses the PFP approach. The synchronous approach in Céu is imperative (there are declarative synchronous languages, like Lustre, that feel more functional) and allows mutation, but in a very controlled, well understood way. The synchronous model is very amenable to formal reasoning, and has had great success in the industry.

It's just that hardware and embedded software has always been decades ahead of general-purpose software when it comes to correctness and verification, simply because the cost difference between discovering bugs in production and bugs in development has always been very clear to them (and very big to boot). There have been several attempts at general-purpose GALS languages (see SystemJ[2], a GALS JVM language, which seems like a recent research project gone defunct). OTOH, I believe Haskell would also be considered by most large enterprises to not be production-quality just yet.

Also, I believe that spending a day or two (that's all it takes -- it's much simpler than Haskell) to learn TLA+ would at least get you out of the typed-functional mindframe. Not that there's anything wrong with the approach (aside from a steep learning curve and general distaste in the industry), but I am surprised to see people who are into typed-pure-FP who come to believe that this is not only the best, but the only approach to write correct software, while, in fact, it is not even close to being the most common one. In any event, TLA+ is very much a general purpose language — it’s just not a programming language — and it will improve your programs regardless of the language you use to code them: it is specifically designed to be used alongside a proper programming language (it is used at Amazon, Oracle, Microsoft and more for large, real-world projects). What's great is that it helps you find deep bugs regardless of the programming language you're using, it's very easy to learn, and I find it to be a lot of fun.

> I am interested, though, in your thoughts on effects, monads and continuations.

Hmm, I’m not too sure what more I can add. Any specific questions? Basically, anything that a language chooses to define as a side-effect (and obviously IO, which is “objectively” a side effect) can be woven into a computation as a continuation. The computation pauses; the side effect occurs in the “world”; the computation resumes, optionally with some data available from the effect. Continuations naturally arise from the description of computation as a process in all exact computational models, but in PFP computation is approximated as a function, not as a continuation. To mimic continuations, and thus interact with effects, a PFP language may employ monads, basically splitting the program/subroutine into functions that compute between consecutive “yield” points, and the monad’s bind that serves as the effect. Due to the insistence of such languages on the function abstraction, having the subroutine return just a single value, composing multiple monads can be challenging, cumbersome and very not straightforward. Languages that aren’t so stubborn may choose to have a subroutine declare (usually if the language is typed, that is) a normal return value, plus multiple special return values whose role it is to interact with the continuation’s scope. An example of such a typed event system is Java’s checked exceptions. A subroutine’s return value interacts with its caller in the normal fashion, while the declared exceptions interact with the continuation’s scope (which can be anywhere up the stack) directly. This normally results in a much more composable pattern, and one that is simpler for most programmers to understand.

> Does your notion of "continuation" require threads? If so, Python fails to have "continuations", right?

"My" notion of continuation requires nothing more than the ability of a subroutine to block and wait for some external trigger, and then resume. Languages then differ in the level of reification. Just as you can have function pointers in C, but that reification is on a much lower level than in, say, Haskell or Clojure, so too languages differ in how their continuations are reified. So, a language like Ruby, is single-threaded and does not reify a continuation at all (I think). You can't have a first-class object which is a function blocked, waiting for something. Python, I think, has yield, which does let you pass around a subroutine that's in the middle of operation, and can be resumed. In Java/C/C++ you can reify a continuation as a thread (inefficient due to implementation). In Go you can do that only indirectly, via a channel (read on the other end by a blocked lightweight thread). In Scheme, you can have proper reified continuations with shift/reset (and hopefully in Java, too, soon, thanks to our efforts).

[1]: http://ceu-lang.org/

[2]: http://dl.acm.org/citation.cfm?id=1823324

Re: Why does Haskell, in your opinion, suck?

#198
post #191
post #186

Earlier quoted context omitted.

In the sense that this blocking can be fully or partially reified. I don't know much about OCaml's implementation of their lwt library, so I'll give an example from Java: In Java you can create a thread running a single subroutine, have that block by calling `park`, and then hold on to that blocked function in a form of a reified object (the thread), which you can resume at any time. This is not possible in Haskell,…

> This is not possible in Haskell, you cannot hold onto blocked subroutines (i.e. continuations); instead, you hold onto a chain of functions connected via a monad (or monads). I don't understand what this means, and I certainly don't understand the difference between the two things.

This means that Haskell doesn't have an object representing a function blocked in mid-operation. The difference is one of abstraction (obviously all languages can ultimately express all computations), which affects composition and mental overhead. These, of course, are empirical effects, and so their merits cannot be justified on any theoretical grounds (theoretically, monads and continuations are the same).

Re: Why does Haskell, in your opinion, suck?

#199
post #84

I had chance to debug one tool built using Haskell. I was amazed how Haskell solution for clean and easy to understand (it was a parsing library generating better optimized SQL queries). The main problems are: - it is hard to find examples/snippets of real-world solutions on net (majority of examples are like Hello world and these examples are not useful) - lack of documentation about building real-world solutions Ma…

You may be interested in the State of the Haskell Ecosystem [1] and School of Haskell [2].

[1]: https://github.com/Gabriel439/post-rfc/blob/master/sotu.md

[2]: https://www.schoolofhaskell.com

Re: Why does Haskell, in your opinion, suck?

#200
post #15

Haven't seen it listed neither here nor there, so not sure if I'm the only one, but: for me, the first and currently blocking obstacle is of "graphical" syntax. I'm of the kind of people who hear the words they read as a voice in their head, so when every line is interspersed with multiple "random" >>= -,-'-- and whatnot other ascii-art I can't verbalise, I distictly feel my brain stumble, mumble, and grind to a halt…

The "separatorless" style is also another aspect of the syntax that's turned me off Haskell --- most other languages have characters like ';' that serve to delimit statements, ',' to separate list elements, and ample use of parentheses to clarify how things should be parsed (e.g. identifier followed by '(' signals "function call", and the matching one signals the end of the argument list.) In comparison, Haskell code…

Haskell does seperate list items (and tuple elements, and record member assignments) with commas.

You are, of course, free to object to the lack of separators between (and parentheses around) function arguments. I find it pretty natural when everything is curried.

Post reply on HN