I have the Haskell Platform 2012.4 installed on Windows. I would like to try the new extensions in GHC 7.6.2. It looks like the GHC 7.6.2 x86_64 download does not include an installer and is just the binaries. What is the proper way to get the latest version installed and set as the default for building Haskell projects? Thanks.
3 Answers
If you download GHC itself, you just get GHC and a tiny handful of libraries. If you download the Haskell Platform, you get GHC plus a much bigger collection of libraries. However, the Haskell Platform is updated infrequently, so you'll get an older version of GHC.
If you're asking "how do I install the Haskell Platform and then make it work with a newer GHC?", then the answer is "you don't". Haskell libraries have to be compiled for the specific version of GHC you're using.
You basically have two options:
- Use the Haskell Platform, together with the version of GHC that it supplies.
- Use the latest GHC, and compile whatever libraries you want manually.
On Linux it's not too bad, but Haskell libraries that bind to external C code tend to be fiddly to build on Windows. (Stuff like OpenGL, zlib, etc.) Packages that are 100% vanilla Haskell code are drop-dead easy to compile on any system.

- 61,854
- 19
- 123
- 220
-
I understand that the libraries need to be built with each version of GHC. I'm just trying to specify the version to be used for building with "runhaskell". I downloaded 7.6.2 which is just a folder of executables, libs etc.. What next? How do I chose between your 2 options? Thanks. – MFlamer Feb 18 '13 at 22:06
-
Hmm, that's interesting. They used to provide MSI installers for Windows. I guess now the Haskell Platform has come along they don't bother anymore. My guess would be that you need to edit the `PATH` variable so the new GHC is listed first. – MathematicalOrchid Feb 19 '13 at 20:04
I haven't done this and I'm at work so I can't test it out, but looking at the GHC docs I would think you can use the --with-compiler=path
flag to select which version of GHC to use?
See also this question, related to using cabal with multiple versions of ghc installed. I would guess that you probably want to use cabal-dev or something to sandbox this, otherwise your package database may become a mess.
EDIT: As far as a default, I think you can set that in a cabal configuration file. See the comments to the accepted answer in that question I linked.
-
Thanks, getting closer. Now cabal is using GHC-7.6.2 but I'm getting errors like this when trying to install libraries.....................Registering nats-0.1... cabal: permission denied cabal: Error: some packages failed to install: nats-0.1 failed during the final install step. The exception was: ExitFailure 1 . Is this because these packages are not designed to be be built with this new ghc version, or is it something I have setup wrong? – MFlamer Feb 19 '13 at 01:20
-
I'm not sure what the permission denied bit is about. Looking at that nats package, it seems like it should build with the latest GHC. Have you run cabal update before running cabal? I'll be honest, this is all unfamiliar territory for me too, so best of luck and be sure to update us with what works. I know people are always talking about how hard it can be to get things working on Windows, you might be a pioneer here :) – tredontho Feb 19 '13 at 03:40
The other answers here are great, and I wanted to add that the current best way to get the latest version of GHC installed is to look at haskell.org's installation instructions. I bounced between lots of different options before I landed there, and I think it's the best source of truth from what I can tell.
To summarize the current instructions: if you already have chocolately set up, "at an elevated command prompt, run choco install haskell-dev
, followed by refreshenv
."

- 705
- 1
- 5
- 14