I've decided to start with Haskell and bumped into an unfamiliar ecosystem. I've wrote down my current conclusions in short and long version (by now I realise the issue I had is probably temporal and won't apply in the future and realise that below text might be a bad fit for SO).
What I want to know now specifically is
- Does the setup I'm describing makes sense to veterans?
- Why is GHC 8.6.5 is the recommend version, and what's wrong with 8.8.2?
Short version:
If this is your first contact with Haskell and you want to install Haskell (ghccup, ghc, cabal-install, stack) and a dev environment made up of Visual Studio Code, Haskell Language Server plugin and HIE.
Make sure that stack new
as per (https://docs.haskellstack.org/en/stable/README/#start-your-new-project) and the HIE you are installing are all resolving
to the same version of GHC that was installed by ghcup
.
Long version:
Hi Haskellers!
I'm sharing my foray into Haskell and hopefully save someone else from a rookie mistake or two.
Like all sensible people I've asked google how to install haskell
,
which led me to the following page https://www.haskell.org/platform/ (I'm on macOS 10.13.6).
I've Downloaded ghcup as per recommendation which in turn installed ghc 8.6.5 & cabal-install 3.0.0.0.
Both are the recommended versions according to ghcup. I was able to ghcup list
, ghcup list -t all
and everything looked good.
stack
was next as recommended.
The procedure is straight-forward and after stack did everything it needs to do I stack --version
which told me that I have
Version 2.1.3, Git revision 0fa51b9925decd937e4a993ad90cb686f88fa282 (7739 commits) x86_64 hpack-0.31.2
.
Next part of stack documentation got me into trouble https://docs.haskellstack.org/en/stable/README/#start-your-new-project.
Specifically stack new my-project
for the uninitiated will setup a new project based on what is called a resolver.
What I didn't knew or care to at this point, is that it by default would use the 15.2 version of the resolver (most recent as I write this) to setup an
isolated environment with "the batteries included" for the project (please correct me on any wrong assumption/terminology).
What I could have not known is that resolver 15.2 "expects" to find ghc 8.8.2 and if it does not find it, it does the sensible thing and installs it.
I intuitevely understand the problem – that this is addressing – and I move on (this is before I've found https://github.com/commercialhaskell/lts-haskell#readme).
Moving on to IDE, google leads me to the haskell-language-server which is not ready for the prime time. Next best thing is haskell-ide-engine which can be considered a part of the whole that haskell-language-server will be. Being naive and satisfied with the experience so far, I build hie from source as I'm neither interested in doing anything with nix at this point or figuring out what a Visual Studio Code DevContainer is. The build is succesfull, so far I've installed HIE, ghcup, ghc, cabal-install, visual studio code package Haskell Language Server and I'm ready to start learning Haskell. Except HIE refused to work :/.
What went wrong?
- ghcup installed ghc 8.6.5 on my machine
- stack new my-project by default used the most recent resolver 15.2 which installed ghc 8.8.2 (isolated to the project)
- HIE build itself (?) by looking at the ghc installed by ghcup which is 8.6.5
The result is a mismatch between version the version HIE is build against and the version that was setup by
stack new my-project
. Once I better understood what parts were involved it was easy to google for solution and forced me to thoroughly read the docs. The fault is all mine for not paying better attention to the docs I was reading. However, I wasn't prepared to have to figure out the nuances of the small but crucial part of the ecosystem.
I do realise that the entire situation is entirely self inflicted and I could've started with learning the language right after installing GHC and firing up GHCI. I'm wondering if I took the wrong turn or if this is how most people start?
Update 25th of July 2020
Haskell Language Server is now much easier to install, have a look at this post and the video at the end of it. https://mpickering.github.io/ide/posts/2020-07-10-ghc-libdir.html