Looking for a newbie Haskell book

I’m looking for a good book to learn Haskell. One without all the sales hype about Haskell. I have already decided to learn Haskell. The sales hype just wastes my time.

I do not need to lead how to feed Lisp code into a Haskell compiler. Just talk about Haskell, not Lisp.

I am an expert programmer with 30 years of experience with the Smalltalk IDE. The lack of a good IDE for Haskell is a definite negative. EclipseFP does not work. Atom does not work for Haskell. Stack and the other are building tools, but moronic compared with the Smalltalk IDE. The Smalltalk System Browser allows me to view everything on my computer. The Package Manager allows me to see what packages I can download and install on my computer. Both Managers are over 40 years old and still better than anything I have seen for Python, Lisp, APL, Prolog, Snobol, or Haskell.

Most books and tutorials talk as if their IDE would actually work on my machine. When it does not, their “help” is useless. All I see are versions of the C make utility.

I need a book for experienced programmers (with a degree in Mathematics) with examples which will work on my machine.

Robert Pearson

Haskell is dramatically different from Lisp. I don’t think any Haskell intro text would be somehow teaching a newbie to ‘translate’ Lisp to Haskell, or aimed at ‘migrating’ someone from Lisp.

If your head is full of Lisp, I suggest the first thing you do is wash the Lisp out of it and start with a blank slate. I also suggest you wash your head of Smalltalk pre-conceptions. Functional Programming is dramatically different from OOP, and needs a different way of thinking/different abstractions. In particular beware that Haskell has artefacts called ‘classes’, ‘instances’ and ‘methods’, which share some superficial similarities but need a whole other mindset vs. OOP classes/methods.

There’s a modern IDE specifically aimed for Haskell/GHC. That is VS Code with HLS (Haskell Language Server) plugin.

Haskell programmers are smart, but not so smart they could guess which machine you’re talking about. If you mean your machine is “over 40 years old” I fear you might be out of luck.

So is it a tutorial on Haskell that you want? Or a tutorial on an IDE? Those are different questions, with different answers.

1 Like

The classic text is Learn You a Haskell For Great Good. It is available as a reasonably priced paperback, and is also available online for free. One problem that Haskell has is that many well-defined terms like functor, monad and class are colourfully and creatively repurposed, and understanding that makes Haskell much easier to understand as a whole.

The classic IDE is Visual Studio Code + HLS, although there is also an Emacs mode for Haskell. Haskell is mathematical in nature. With Lisp, you can iteratively hack something into existence within the current image, but with Haskell you are supposed to figure it out before you code it.

I used Chocolatey to install the Haskell software, although there are also online services like Haskell Online Compiler & Interpreter - Replit

Enjoy!

PS: Please dial back on the “Smalltalk is wonderful, but your language is stupid” - for your sanity as much as ours.

3 Likes

If you are looking for a more serious textbook on Haskell, then I would highly recommend Graham Hutton’s Programming in Haskell. He also posted his lectures on YouTube: FP and the follow-up AFP.

If you want a book about a mathematical approach to programming then I’d recommend the draft of Program Design by Calculation by José Nuno Oliveira (but, beware, you won’t learn how to setup a web server or command line application here).

As for installing the toolchain, the recommended option on all platforms is GHCup.

4 Likes
  1. Install Nix
  2. Install VSCode
  3. Open this template in VSCode
  4. Read through Graham Hutton’s or Richard Bird’s book

“Good” is a bit of a subjective metric… so you might get lots of suggestions, none of which are “good” for you, or only good for a little bit of what you want to do.

For years I struggled, wanting to get more done than my ability to navigate and understand all the related topics. I would recommend spending a little bit of time defining what you want to do, and then map that to a set of topics you should learn more about to accomplish that. For example, if you want to interact with JSON vs interact with AWS APIs vs run a mathematical model vs process text… these will also require a different set of topics, and you won’t get far without understanding those topics.

Here are some thoughts which might help sort through the options:

  • Do you want a free book/tutorial, or are you willing to pay a few bucks?
  • Do you want thorough explanation of details, or a quick introduction to general possibilities?
  • Do you want to understand haskell the language, or how to build quality software with haskell? There are a few “Production Haskell” type books and tutorials. There are also people/blogs you can scour to better understand these topics.
  • Do you want to focus first on writing some haskell as quickly as possible, or do you care about knowing how to build and run that haskell code in the real-world? You’ll need to understand a fair bit about stack and/or cabal to be able to build and run your code, an alternative is to restrict yourself to ghci/etc to start and ignore stack/cabal.
  • Are you willing to restrict yourself to the base/prelude (standard lib) included with GHC, or how quickly will you need/want to start using packages with other people’s code? You’ll need to understand more about hackage and stack/cabal. There is also stackage, which is related and very useful, but could be skipped (or not) depending on your requirements.

Skipping the other resources that have been mentioned, I’ll add to the list:

Chris and Julie’s Haskell Programming from First Principals

As well as the old haskell-lang site, which was moved to Applied Haskell Syllabus.

Haskellbook (Haskell Programming from First Principles) is a good reference tome (our The C++ Programming Language), and you can learn from it, but it’s long.

For something more practical and interesting, I’d suggest working through Get Programming with Haskell by Will Kurt and published by Manning.

Here is a Jupyter adaptation of the book Learn you a Haskell for Great Good!. You can edit and execute all the examples and you literally don’t have to “install” a single thing, it just runs in your browser.

2 Likes

Not a book, but a video course; IOHK / Well-Typed Haskell course is pretty good, from basics to Haskell’s core with interesting exercises. I helped to teach it once, that’s how I stumbled upon it :slight_smile: I think it’s also available on coursera.

Learn You a Haskell is the one that I used, but there are a variety of books, depending on your needs.

Why have you decided to learn Haskell? What are you trying to get out of it?

I love Haskell, and I found it to be superior (at least in a great many ways) to languages I already knew. But if you feel that Smalltalk is better than any other language out there, I suspect that learning a new language will be frustrating.

For Haskell, we have the Hackage website for that.

I recommend against writing Makefiles to build Haskell code. The idiomatic way is to write Cabal files.

Check out the platforms that GHC supports. If you are not on a Tier 1 or Tier 2 platform, Haskell probably won’t work for you. Even among Tier 2 platforms, you will be much happier if your platform supports GHCi. Not only is GHCi support necessary to run GHCi itself, but GHCi support is also necessary to use Template Haskell. (There are a number of packages on Hackage that use Template Haskell, so those packages won’t be usable on a platform without GHCi support.)

1 Like

Awesome! The book you recommended is by Jose Nuno Oliveira is like none other. Thanks so much.