Most suitable GHC version for education

Hi all,

I’m running a Haskell course starting in a couple of weeks, for the second time. Last time around we used GHC 8.10.* (I think it was originally 8.10.6), and I’m wondering what the most appropriate choice would be this time.

Ideally, we want the optimum of:

  • Stability
  • Ecosystem support (mainly haskell-language-server but ideally stack too, since we use that to hide away the details of dependency management in a way that is suitable for our lab environment)
  • Good errors, if there are any changes to the errors for simple cases

Feature-completeness isn’t really a factor, though if there are any rough edges around simple example code in particular versions then I’d like to avoid that too.

GHC 9.2.5 is currently marked as recommended but not hls-powered in ghcup. 9.4.2 is hls-powered but 9.4.3 and 9.4.4 have been released since and those are not.

Two cents appreciated!

1 Like

Update: I was misreading the behaviour of ghcup: it marks as hls-powered only those which are supported by the version of hls currently marked as active. (that seems like a bit of a rough edge, but never mind!)

So any of the latest 8.10.x, 9.0.x, 9.2.x and 9.4.x are in consideration vis-a-vis hls, though probably not stack.

Since your student body will certainly be composed of macOS M1 users, GHC 9.2.5 + -XGHC2021 + OverloadedRecordDot will be most appropriate.

3 Likes

If any of your students are Windows users, then be aware that all GHC versions before 9.4 are, essentially, broken on Windows due to recent changes in MSYS2. See [windows] GHC fails to link due to msys2 crt update (#21111) · Issues · Glasgow Haskell Compiler / GHC · GitLab.

More specifically, if MSYS2 is updated to include MSYS2 package mingw-w64-x86_64-crt-git then GHC < 9.4 fails. The good news is that the Stack-supplied MSYS2 does not include that MSYS2 package. The bad news is that package is a dependency of some interesting graphics packages.

4 Likes

so if I understand well, one should use GHC 9.2 with stack unless the course uses the graphics packages?

You can use GHC 9.2.5 on Windows (with Stack or any other supplier of MSYS2) as long as you don’t update MSYS2 to cause it to to install MSYS2 package mingw-w64-x86_64-crt-git.

2 Likes

That’s good to know. Our students are warned away from using Windows for a few reasons, but I’ll still expect a couple of dozen to prefer it. I will test out the setup and write a short guide for them.

In that case I’ll probably go with 9.2.5, and will consider whether or not to enable GHC2021 by default. Thanks!

1 Like

If you do not specify a ‘language’, then GHC 9.2.5 enables GHC2021 as the default.

stack new uses a default project set-up template that uses a plain package.yaml and Hpack, by default, then generates Cabal files that specify default-language: Haskell2010. However, from Hpack 0.35, Hpack’s language key accepts GHC2021. (Stack >= 2.9.1 is built on top of Hpack 0.35.) stack new can be used with your own project set-up template(s).

3 Likes