TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Haskell: The Bad Parts, part 2 (2020)

258 pointsby anuragsoniover 4 years ago

15 comments

ciesover 4 years ago
I&#x27;m enjoying the read. Having written a fair deal of Haskell, I&#x27;m really grateful for what leaning Haskell told me about programming at large. Snoyman has written amazing libs and acute articles, and I appreciate this series a lot.<p>My interest though are: what&#x27;s next?<p>Can Haskell evolve? Can we move to a better standard lib? Here Snoyman has put forward a great effort by releasing his classy-prelude, but iirc he also stopped using it.<p>So what can be done? Could we come up with a new Haskell-spec version that fixes some of these, flips some pragmas to be on-by-default? I can imagine that laziness is not going out, it too much at the heart of the language: or am I just assuming that? But besides laziness there is a lot to fix by just setting a new standard. It will help newcomers, an eventually even old codebases may make the jump.<p>Some part of this article talks about partial functions. To what extend can we do without? Can we build a checker [1] for that and simply disallow it?<p>1: <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;42151927&#x2F;what-is-haskell-missing-for-totality-checking" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;42151927&#x2F;what-is-haskell...</a>
评论 #26078597 未加载
评论 #26079186 未加载
评论 #26078629 未加载
评论 #26083959 未加载
评论 #26078356 未加载
评论 #26080581 未加载
评论 #26080347 未加载
评论 #26078330 未加载
评论 #26078605 未加载
评论 #26080364 未加载
评论 #26086743 未加载
Ericson2314over 4 years ago
I have a <a href="https:&#x2F;&#x2F;github.com&#x2F;ghc-proposals&#x2F;ghc-proposals&#x2F;pull&#x2F;351" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ghc-proposals&#x2F;ghc-proposals&#x2F;pull&#x2F;351</a> in the works for the stupid partiality issue.<p>As for the library ones:<p>1. Rust&#x27;s std is better now, but will eventually sink to the level of base as ideoms improve because neither language has a good process for making breaking changes to the standard library<p>2. Rust has the core---std split, which Haskell desperately needs. Vector absolutely should be a separate package, but just the way alloc and hashbrown are separate packages in Rust land.<p>Trying to work on that too.<p>Now that Michael Snoyman thinks that exceptions in pure code are bad, and likes Rust, I wish he would think that exceptions in IO code are also bad, and we should use more EitherT like Rust.
评论 #26079454 未加载
评论 #26079273 未加载
jamwtover 4 years ago
&gt; And if I write a &quot;Rust: The Bad Parts&quot;, believe me, I&#x27;ll be mentioning panicking.<p>This is why `panic=abort` should be the default, and the whole unwind-and-try-to-keep-the-world-sound path should be opt-in. Then panic is truly like `assert` and I&#x27;m guessing most of his objections would be gone.<p>My guess about default-panic behavior being unwind is rust&#x27;s origins in the servo project. When you&#x27;re part of a very large monolith that should try very hard not to crash (a browser), you will put some work in to try to make this unwinding okay. Yes, tests still want panic to unwind, but you could opt in to this to, or change the default in a `[test]` context, or a bunch of other things I&#x27;m sure smarter folks could argue in an RFC. But getting correctness right in prod should be goal #1 IMO, so it should bias toward abort.<p>For most places rust is probably actually used today (server-side), crashing is the safer and simpler behavior, and things like lock poisioning are not things you need to reason though.<p>I know the article is about Haskell, so not trying to derail it, but I have a really similar Haskell -&gt; Rust path in my background, so a lot of the rest of Michael&#x27;s reactions here are just +1 for me. For example, yes, exactly this about partial functions.<p>And, IMO, laziness, which he hints at in this section. The default should be the other way. Nothing worse than an `error` that&#x27;s fired in some unexpected place&#x2F;time due to lazy evaluation, and some thunk landed somewhere technically correct, but infuriating. Trying to figure out what the heck is going on can be really challenging&#x2F;frustrating (as of my prod experience in Haskell 8-11 years ago, not sure what&#x27;s gotten better&#x2F;worse since then in ghc-land.)<p>I learned a <i>ton</i> from Haskell, and am so glad I used it in depth for awhile (ditto ML). But these days, to actually build something I want to build with long-term value in mind, either individually or as part of a team, I just use Rust. I get most of what I loved about Haskell without the annoyances.
评论 #26084559 未加载
评论 #26084255 未加载
评论 #26082799 未加载
brokencodeover 4 years ago
Speaking as an outsider to Haskell, I have to say that while its core purely functional ideas are a little hard to wrap my head around, what daunts me the most is the incredible number of different ways there are to do everything, some recommended, some relics.<p>You have to ask so many questions when you start learning Haskell:<p>Should I use an alternate prelude? What string type should I use? Should I use lens? What package manager and build system should I use? What IDE plug-in works the best? What language extensions should I use? Should I make use of laziness, or try to avoid it? Are linear types a thing yet and should I use them?<p>And on and on the questions go.. these aren’t questions that move forward the product, but just an endless list of boring details to figure out.<p>I’d love a new version of Haskell with all the incredible power of GHC but without the standard library cruft. With all the best extensions picked out and on by default. With a wonderfully thought out stack and set of recommendations, along with a clear guide describing all of this, similar to what the Rust ecosystem has.<p>In short, Haskell to me seems like a playground of interesting ideas rather than a coherent ecosystem for building software. Which I think is true since it’s a research language, but that’s what stops me from using it.
IggleSniggleover 4 years ago
I’ve been meaning to learn Haskell. I appreciate this post for being honest that there are warts and that there’s a body of “community” knowledge about “the right” and “the wrong” way to do Haskell that might not be immediately evident.<p>Anyway, a good read, even for an outsider to the ecosystem.
评论 #26078322 未加载
评论 #26078471 未加载
评论 #26078580 未加载
评论 #26080042 未加载
评论 #26081468 未加载
评论 #26080310 未加载
madmax96over 4 years ago
I’m a relative newcomer to Haskell. I still haven’t used it for anything serious, but I’d like to.<p>I had experienced all of these problems. Initially, I was attracted to Haskell for the promise of “if it compiles then it’s probably correct.” I quickly discovered that isn’t true, for the reasons discussed in the article.<p>But I also had issues with Cabal. I couldn’t get Snap to install. I tried installing it in a container, still didn’t work. I finally figured out something that would let me build with Snap, but for some reason LSP in Emacs couldn’t find the snap libraries, so it couldn’t provide me correct feedback. And then the build times. Wow. I gave up on writing that program in Haskell and wrote it in Go instead.<p>I think Haskell has a lot to offer. I’d be open to trying it again. Hopefully these shortcomings improve.
评论 #26082156 未加载
dgellowover 4 years ago
This series of article should be turned into a linter. I&#x27;m only half joking!
swagonomixxxover 4 years ago
I&#x27;m not sure I understand the relationship between partial function and exception handling. Aren&#x27;t partial functions just curried? One or more arguments are bound, but not all? At least in Python, if you partial-ify a function that raises an exception, it still raises. I don&#x27;t understand if the author likes that behavior or doesn&#x27;t. Maybe this is some Haskell implementation detail that I&#x27;m not aware of.<p>Last time I wrote any non-trivial Haskell was in 2014, so a long time ago, but I found that my biggest problem with it at the time was the really huge variety of Haskell in the wild. If you&#x27;re doing simple stuff, you probably stick to the prelude and you&#x27;ll be happy. But if you&#x27;re doing anything that&#x27;s a bit complex, you&#x27;ll end up seeing hundreds of mini-dialects of Haskell in the wild, so much so that I found it really difficult as a newcomer to understand code on the net. In many cases it&#x27;s almost like a different language completely, what with the user-defined infix functions, tons of currying everywhere, laziness, and the like, made it very difficult to follow code paths.
评论 #26079289 未加载
评论 #26078479 未加载
评论 #26078503 未加载
评论 #26078490 未加载
评论 #26078519 未加载
Decabytesover 4 years ago
I&#x27;m curious about the tweet that says<p>&gt; True mastery of Haskell comes down to knowing which things in core libraries should be avoided like the plague.<p>and one of the examples is foldl. foldl is used in Racket and other lisps, is Haskells implementation poor? Or are there better alternatives? I admit it&#x27;s tricky to grok at first<p><i>Nevermind</i><p>I read further down the page and my question was answered. Should have actually read the article!
评论 #26079124 未加载
munk-aover 4 years ago
So if I&#x27;m a PHP developer that actively uses lazy evaluation patterns in his day to day that means I&#x27;m... best of both worlds? (Hint: I am!)<p>Lazy values are a very powerful tool in the context of responding to requests as an intermediary between a client and a database due to how neatly you can reduce your peak memory usage - a lot of web-stuff follows the basic pattern of<p>1) Accept request<p>2) Figure out query to send to DB<p>3) Sent results to the user<p>Since results aren&#x27;t actively scanned by the server in many cases the goal of being able to pass-through data without directly exposing any of your internal guts to the client is a noble one to pursue.
评论 #26081587 未加载
cjstadlerover 4 years ago
What does it mean for a type class to be &quot;law-abiding&quot;? I&#x27;m coming from Rust so I&#x27;m curious what the &quot;issue&quot; is with FromIterator.
评论 #26088279 未加载
mcguireover 4 years ago
Wow. It&#x27;s almost like Rust has 20 years of programming language development experience on Haskell.<p>(Note: Haskell and Rust are different languages, for different uses. Haskell has many advantages over Rust (some of which the author (and I) have probably complained about at some point). But many of the things that Rust does right and Haskell does wrong, Rust gets right <i>because</i> Haskell did them wrong.)
jari_mustonenover 4 years ago
Not written in same spirit but his reminds me of the evergreen classic C++ FQA Lite. FQA of course stands for &quot;frequently questioned answers&quot;.<p><a href="https:&#x2F;&#x2F;yosefk.com&#x2F;c++fqa&#x2F;" rel="nofollow">https:&#x2F;&#x2F;yosefk.com&#x2F;c++fqa&#x2F;</a>
steelheadflyover 4 years ago
The Good Parts book by Crockford had its&#x27; focus on the language features (as opposed to prevailing conventions or the failures in the standard library). Not sure if this lived up to the spirit 100%. But outside of that, great stuff! (:
theszover 4 years ago
As a long time Haskell user (from 1998 - my career started at 1989) and professional Haskell programmer, I should say that Snoyman is quite responsible for what I do not like in Haskell infrastructure.<p>At 1998, Haskell was a joy to play. At 2008, it was still a joy to play - I really played through ghci (interpreter) implementing MIPS core. And, later, implementing a eDSL that can compile Haskell description of MIPS interpreter into VHDL.<p>I also ghci&#x27;d through VHDL compiler prototype.<p>At about 2009 or so there comes a cabal, a tool that &quot;helps building large application&quot;, which took all the fun away.<p>I had to manually download and put into local version control all packages I needed for a project. I also mandated, being the team lead, that we do not use cabal packages, we use stable sources of packages downloaded into our version control for easy inspection and problem fixing.<p>That was my last attempt to bring fun (not &quot;fun&quot; as in &quot;functional&quot;, but &quot;fun&quot; as &quot;joy to play with&quot;) into my programming duties.<p>Then there was a stack by Snoyman. It was purported to bring easiness back into cabal-based Haskell world of building applications. The problem is that easiness does not equal joy. You can use Roomba with easiness yet Roomba mopping floor would give you any resemblance of joy first one or two times it works on your command.<p>That stack thing did not brought back the joy of use of Haskell. It did not provided you with ALL sources (only interface package authors intended) for you to consume, play and learn. It was all that boring cabal all over again.<p>He was able to fix that - he had the power. He just does not care about learning from other&#x27;s code, I guess.<p>Me, on contrary, I do not have power there. But I have my goals set to bring the joy back into Haskell programming.<p>And now let me somewhat relate that with the article.<p>The &quot;partiallness&quot; of functions he referred there quite often, can be learned, through REPL interpreter and often quite useful. I used partiality quite fruitfully in development of the MIPS core I mentioned above - and yes, I was in full REPL control of all of my code.<p>For that fruitfullness, one need not only compiled and installed package(s), but sources. To see, to learn, to modify.<p>This is where stack by Snoyman fails as miserably as cabal it wanted to replace.<p>One would see that article as a critique of Haskell. I see a failure to see and acknowledge one&#x27;s shortcomings.