Snap on Windows

Snap is a web framework for Haskell. Here are some notes on what I had to do in order to make it work on Windows. Caveat emptor, your mileage may vary. Hopefully this is of use to someone.

1. Install the Haskell Platform. You want version 2012.2.0.0 or later.

2. Install Git. You’ll need this later.

3. Open up a command prompt and type:

cabal install snap

This will run for some time, and, if your experience is like mine, eventually fail while trying to build the "network" package. It will complain about the fact that a configure script is present and that it needs a Unix toolchain for that. If this step actually succeeds for you, great, you’re done. If it failed on something else, good luck to you.

4. Open up a Git Bash window. Type:

which ghc

to find your GHC location. It will be something like /c/Program Files/Haskell Platform/2012.2.0.0/bin/ghc. In the 2012.2.0.0 folder will be GHC’s installation of mingw. Add the path to that mingw folder’s bin folder. On my machine, this looks like:

export PATH=$PATH:/c/Program\ Files/Haskell\ Platform/2012.2.0.0/mingw/bin

You can verify that you’ve done it right by checking to make sure you can run gcc:

gcc --version

if you get a message with a version number back, you’re ready for the next step.

4. Run:

cabal install network

Assuming that worked, go back to your original command window and do:

cabal install snap

5. If this fails with a compile error in the snap package as it did for me, then do:

git clone git://github.com/snapframework/snap

6. cd into the newly created "snap" folder

7. Run

cabal install

to build and install from the source version

You’re done! You can now follow the Getting Started guide to create your first Snap application.

One Comment

  • Jens Petersen wrote:

    Have you tried with HP 2011.4?
    That is good enough for snap on Linux.
    But if you’re installing afresh, then sure
    nice get the latest stable ghc+HP pair.