← Back to context

Comment by nickzelei

2 days ago

Interesting read!

On a semi-related topic: I tried learning Haskell this past weekend out of curiosity that I last tried it some 10+ years ago while still in college.

I found resources for it scant. Coming from more modern languages/tooling like Go/Rust, I also struggled quite a bit with installation and the build/package system.

I tried the stack template generator for yesod/sqlite and after some 15 minutes of it installing yet another GHC version and building, I eventually ctrl+C'd and closed out of the window.

Maybe this was a unique experience, but I'd love some guidance on how to be successful with Haskell. I've primarily spent most of my professional years building web services, so that was the first place I went to. However, I was taken aback by how seemingly awful the setup and devex was for me. I've always been interested in functional programming, and was looking to sink my teeth in to a language where there is no other option.

The easiest and fastest way to get everything installed is ghcup https://www.haskell.org/ghcup/

As for being successful, there are several nice books, and several active forums. I've gotten good answers on the Libera IRC network #haskell channel, and on the Haskell matrix channel #haskell:matrix.org

If you want to get started without installing anything, there's the exercism track: https://exercism.org/tracks/haskell

I've heard good things about Brent Yorgey's Haskell course ( https://www.cis.upenn.edu/~cis1940/spring13/lectures.html ) but haven't tried it myself.

My understanding is that Cabal has more or less supplanted Stack. Use GHCup to install everything, then use `cabal init`, `cabal run`, or `cabal repl` like you would in Go/Rust.

Stack builds on top of Cabal, and used to solve a bunch of problems, but the reasons for it's existence are no longer super relevant. It still works totally fine if that's your thing though.

  • That is so interesting and is a point where GPT has failed me if this is true. My understanding was the stack was the choice due to having better ergonomics over cabal. Apparently that isn't true? I Found that stack init was pretty decent at setting up a project structure, but can't say I tried cabal init.

    I initially installed ghcup via homebrew but found that did not set things up correctly and had to follow the install from their site, which made things work more smoothly.

    • stack does generally have better UX. cabal hasn't supplanted it (and won't). But each has their strengths, the right tool for the right job.

It's not just you. There are a ton of resources of different kinds and freshness, and they're hard for a newcomer to find and evaluate quickly, so luck enters into it. Please also try: https://joyful.com/Haskell+minimap

The tools are a bit complex due to the long history and the design choices of other tools, beginning with GHC. Often they are understood only partially, or they are too hard to write about clearly and teach/learn quickly, or they have failure modes that haskellers navigate instinctively but newcomers without support get stuck on.

Like shae I recommend keeping a haskell chat room handy for quick tips, but don't get too sidetracked. The IRC channel has a greater tendency toward intricate language discussions than the matrix room.

ghcup is a good tools manager; stack can also install tools, and has better support for Windows.

I loved the book "Real World Haskell" [1] when it first came out in 2008. It feels like a shame it hasn't aged well and there hasn't been an updated edition since then. Especially because it was focused on things like "here's how you build example web services" as a good place to discuss everything else by having the end goal of the book's "narrative" structure be real world things you might build. It may still help to glance at a little, but things have advanced so much in the decade and a half since the book was written it is hard to recommend, but it still feels like there should be a book like it updated for current day to be out there to more heartily recommend. If there is one I don't know of it, but I haven't followed Haskell as much as I'd like in my professional career.

[1] https://book.realworldhaskell.org/

I learned using the Haskell Programming from First Principles book (haskellbook.com). I don't think it goes into web development, but it certainly goes through the basic project setup.

Do you think you would have benefitted from a resource like the Rust book? I've been toying with the idea of writing something similar and donating it to the Haskell Foundation

  • I've seen this book referenced a few times and is quite large from what I've seen.

    Not opposed to checking it out, but to your question: I really like the Rust book and how easy it is to find and read. It feels modern, up to date, and the standard for how to learn Rust.