Saturday, May 15, 2021

GHCUP for managing GHC versions

GHCUP for managing GHC versions 

https://qfpl.io/posts/multiple-ghcs-ghcup/


When I develop a Haskell project, I use Stack. But some Haskell projects that I am interested in rely on Cabal (BTW, I am still confused by cabal-install, which is a Haskell package name, or by cabal, which is a command-line. Refer to [1]). 


Alex and Happy are such projects. For those who do not know what they are, Alex is a lexical analyzer tool, and Happy is a syntax analyzer tool. Both of them have their own specification languages and after some processing, they produce a Haskell program that do the analysis. 


For some reason, I wanted to build these two projects from source. This required me to install GHC (including cabal). If I use Stack, GHC is automatically downloaded when a project is built just by a command-line, stack build. If I use Cabal, it doesn't seem to be so. I need to install GHC by myself. This is where GHCUP helps me very much. 


Build systems, package installers, and package managers seem to be a huge obstacle to Haskell beginners such as myself. 


[1] Repeat after me: "Cabal is not a Package Manager"

   : https://ivanmiljenovic.wordpress.com/2010/03/15/repeat-after-me-cabal-is-not-a-package-manager/