Search code examples
windowspowershellpowershell-3.0appveyor

How to install GHC in Appveyor and put GHC in path?


I'm trying to install GHC on windows with the following script (and put ghc in path), but it fails when I try to run ghci --version. I think there is something wrong with the script.

install:
  - ps: Invoke-WebRequest "https://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz" -OutFile "ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz"
  - 7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz
  - ps: $env:path += "C:\projects\haskell-interactive-mode\ghc-8.0.2-i386-unknown-mingw32-win10.tar\ghc-8.0.2\bin"
  - ps: ghci --version

Solution

  • I tried your command on local Windows machine and I see that 7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar.xz results in ghc-8.0.2-i386-unknown-mingw32-win10.tar file, not folder. If you unzip it further with 7z x ghc-8.0.2-i386-unknown-mingw32-win10.tar, it unzips into real folder named ghc-8.0.2 with bin subfolder and ghci.exe file.

    However I think that simpler it would be use Chocolatey package. This works for me well:

      - choco install ghc
      - refreshenv
      - ghci --version