8 ms·
The design of the Strict Haskell pragma
- haskeldownvot5 11y agoIdris is strict by default and has a stronger type system than Haskell that supports dependent typing and in effect forced the hand of the GHC developers and the wider Haskell community by showing laziness, one of the most unpopular aspects of Haskell, to be completely unnecessary for a modern, purely-functional language. The strict pragma is a tacit admission that default non-strict evaluation was a mistake, and all of those who defended it here and on proggit for years should come clean and apologize for having done so, especially those who dishonestly tried to pass it off as an optimization while knowing full well that "spaceleaks" are one of the biggest performance concerns with deploying non-trivial Haskell code in production. I wrote off Haskell entirely for that very reason, and I'm not alone in having done so (search HN comments). In fact, I would wager that if Haskell had not adopted such an unusual evaluation strategy, GHC would have required only a tenth of the manhours that have presently gone into it. Yes, you CS PhDs who secretly wish you were math PhDs wouldn't be able to write toy programs with infinite lists, but that's a small price to pay for lowering the language's skyscraper-steep learning curve and giving it predictable, easily reasoned-about performance characteristics.
- spooningtamarin 11y agoLaziness helps a lot with composition, when designing an interface you can have functions with arguments that won't be used by every implementation but have no performance overhead. Although, most of the time laziness is only useful at a single level, and that kind of laziness can be easily done in languages like C++ with a much lower overhead. It's a bit sad that GHC has so many advanced code optimization methods but performance is still lacking. Yes, you can write high-performance Haskell but it requires expertise or huge amount of profiling and time. On the other hand, you can easily write faster (speed-wise) prototypes in C++ and get superior performance almost all the time. List of ways to write performant Haskell: https://news.ycombinator.com/item?id=10209798 https://news.ycombinator.com/item?id=10209798
- codygman 11y ago> Yes, you can write high-performance Haskell but it requires expertise or huge amount of profiling and time. Is there a language X that allows you to write high performance X without huge amounts of profiling and time? > On the other hand, you can easily write faster (speed-wise) prototypes in C++ and get superior performance almost all the time. You can't really compare development time though can you, even with C++x11? Even if so, you should probably specify the version of C++ you are referring to since they can mean very different experiences. > List of ways to write performant Haskell: https://news.ycombinator.com/item?id=10209798 https://news.ycombinator.com/item?id=10209798 Cool!
- spooningtamarin 11y ago> Is there a language X that allows you to write high performance X without huge amounts of profiling and time? Yeah, if high-performance is something faster than Haskell I'm already there with C++. If I understand copy/move semantics I won't get bitten by anyone, same thing with laziness in Haskell, although sometimes I stumble a bit. Of course we're all talking about C++14. I guess everyone else is talking about GHC 8.+, at least in this thread. > You can't really compare development time though can you, even with C++x11? Even if so, you should probably specify the version of C++ you are referring to since they can mean very different experiences. Write a highly performant discrete optimization in Haskell using monad transformers that have overhead, laziness that has overhead, and almost everything has several levels of indirection. Yes, I can write a prototype that is sufficiently fast, I can then profile and write a version that Haskell might never reach. And yes, it'll probably take me less time to do than to do the same with Haskell, it might be my lack of expertise, who knows, I've tried.
- haskeldownvot5 11y agoThe Haskell community is by far the most abrasive and hostile to criticism of any programming language. You can get away with voicing trite complaints about too many parentheses in a thread on Lisp, but nearly any comment here critical of Haskell ends up at < 0. Attempting to shutdown your critics is a great way to alienate the unconverted. "Avoid success at all costs" indeed.
- johncolanduoni 11y agoPerhaps you are being shutdown because you are combining your criticism with condescension and personal attacks? Like deciding that people were being "dishonest" because they don't agree with you and argue for their opinion? Or levying insults against CS and math PhDs? I haven't done enough Haskell to be part of the community (and to have bought into whatever hostile groupthink you think surrounds it), but I down-voted you just the same for being a complete jerk.
- haskeldownvot5 11y ago> Like deciding that people were being "dishonest" because they don't agree with you and argue for their opinion If they knew about the dangers of spaceleaks, then they were being dishonest when advertising laziness as a benefit to performance. > Or levying insults against CS and math PhDs? I referred to CS PhDs who wish they were math PhDs, not math PhDs. Math PhDs neither know nor care about Haskell.
- dpratt71 11y agoIndeed. There is something very familiar about the tone and content of these posts from haskeldownvot5. There was another individual that achieved a degree of infamy within the Haskell community for posting similar screeds to various forums. The claims that the Haskell community can't accept criticism, the accusations of the same 'lying' about performance, the referring to 'lazy evaluation' as though it were a carcinogen, the aspersions cast against the education of various individuals, both specific and non-specific...yes, all very familiar. I think there's some interesting psychology at work here. haskeldownvot5 is clearly inviting downvotes by his/her choice of username as well as the contents of his/her posts, but I think haskeldownvot5 has managed to convince himself/herself that there is some cabal within the Haskell community that is responsible for the downvotes. There must be a name for the phenomenon where an individual brings things upon themselves and then uses the criticism/persecution they receive as evidence to the fact that they were right all along.
- Kutta 11y agoNice username! The strict pragma is not an admission of mistake anymore than any pragma and language extension is an admission of mistake. It's a feature, dammit. Also, note that laziness was an exploratory design deicision made 25 years ago, when functional programming in industry flat-out didn't exist, and even 25 years ago there were critics and proponents of laziness, and there were strictly evaluated alternatives, such as ML, so it's quite ridiculous to say that Idris "forced" the Haskell community in any way. I would certainly like if Idris compelled Haskell to go more swiftly towards dependent typing than it's going right now, but that's another story. I personally prefer strict-by-default evaluation to laziness for production code, (and in turn would prefer total programming with data/codata to that if it existed in a mature language), but laziness has its own place and there are huge numbers of use cases of laziness in Haskell that have been reiterated over and over here and elsewhere. In any case, the situation doesn't warrant the degree of conceit you display.
- haskeldownvot5 11y ago> Nice username! Appropriate given the response any criticism of Haskell elicits. > strict pragma is not an admission of mistake anymore than any pragma and language extension is an admission of mistake. It's a feature, dammit. A feature that likely wouldn't exist without Idris offering such a compelling, strict alternative to Haskell. > I personally prefer strict-by-default evaluation to laziness for production code So would I, which is why I wrote off the language, and why the GHC devs have had to back-peddle and add this pragma.
- dtech 11y agoI rather think the downvoting is based on your inflammatory style, and rather baseless accusations and speculation. I downvoted you because of that, not because I'm some Haskell fanboy who can't handle critique.
- themetrician 11y agoI don't see anything inflammatory about their style. They are just being straightforward and laconic. HN down-voters (the old-timers) are such a sensitive bunch. Students in Mizzou can yell at their professors as they throw their tantrums and no one dares bring them down to civil discourse; be laconic in a HN forum and you get downvoted for not being sensitive to old-timers' feelings.
- tibbe 11y agoAs the designer of the Strict pragma I can say that Idris had nothing to do with anything.
- thechao 11y agoI know this is anecdotal: at my undergrad state university (UT) the intro to programming for non-programmers (I was a liberal arts major) was (is?) Haskell. Personally, I think it's a great first language---along with Python. "Getting stuff done" Haskell has virtually no learning curve. Generally, you can introduce new (deeper) concepts as the student's & learner's run into issues on the 5th or 6th time. I think UT's pass-rate for it's Haskell class is just as good as TAMU's intro-to-programming (which is C/++).
- tdees40 11y agoI love the idea that Haskell users are all wringing their hands about .... Idris.
- lmm 11y agoIs that so implausible? If you like the things that make Haskell different from other programming languages, Idris does most of the same things, only more so. It's the first language with a better type system than Haskell's to become even remotely mainstream.
- ch 11y agoDoes the bang pattern have the opposite semantics when Strict or StrictData pragmas are in use? Can one recover lazy semantics inside a Strict module? That would be convenient/confusing!
- tome 11y agoYou can use ~ to get lazy semantics, apparently.
- b6 11y agoBack when I was way into Haskell, Johan Tibell was the guy I tried to be most like. I learned a lot from him not only about Haskell, but good software development practices in general, and how to work better with others. Great guy.