Why do that and not use Haskell Platform instead?

From what I have experienced so far, Haskell Platform falls behind the latest GHC release, and ships with Packages that one might not need.

Essentially there are two things needed:

  • GHC – Haskell’s compiler and interactive environment.
  • Cabal – Haskell’s build system, which also doubles as a package manager.

GHC

  • Download GHC for Windows from here.
  • Extract GHC contents to a folder and add to PATH
  • \ghc-x.y.z\bin
  • \ghc-x.y.z\mingw\bin

Cabal

  • Download Cabal for Windows from here.
  • Extract Cabal executable to a folder, open a command prompt (cmd.exe) and execute:
  • cabal-x.y.z.exe install
  • cabal-x.y.z.exe update
  • Open a MSYS-compatible (e.g. Git Bash) shell and execute:
  • cabal-x.y.z.exe install cabal-install

In the beggining I was wondering what a MSYS-compatible shell is, but it turns out the shell offered by Git Bash will do fine.

I was also wondering what's the difference between Cygwin and MinGW and came across this great Q&A on Stack Overflow.

  • Delete cabal-x.y.z.exe (after cabal-install is completed successfully)
  • Add C:\Users\[YOUR USERNAME]\AppData\Roaming\cabal\bin to PATH

Did it work out?

Open a command prompt (cmd.exe) window or a Git Bash window and execute where cabal, which should print the path where cabal executable resides:

C:\Users\[YOUR USERNAME]\AppData\Roaming\cabal\bin\cabal.exe

In the same command prompt executing ghci should launch GHCi (Haskell’s interactive environment):

GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
>

To get the > character show up in the prompt, add the following to C:\Users\[YOUR USERNAME]\AppData\Roaming\ghc\ghci.conf:

:set prompt "> "

That’s it – Happy Haskell Programming!