Haskell on Windows Setup Haskell on Windows Setup windows windows

Haskell on Windows Setup


DISCLAIMER: What's below was valid in Oct, 2013. So there is a good chance it might get outdated soon. Your edits and comments are welcome.

This is what I have done in order to get Haskell set up on my Windows 7 x64

1. Install Haskell Platform

Download and install the Haskell Platform from http://www.haskell.org/platform/windows.html

2. Install Sublime Text 3

Download and install Sublime Text 3 from http://www.sublimetext.com/3

3. Enable the Package manager in Sublime

  1. Run Sublime
  2. Open the console: View >> Show console
  3. Paste the following code to the console and hit Enter (according to this):

import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())

  1. Open the command palette: Tools >> Command palette
  2. In the command palette popup type in: Package Control: Install Package
  3. Select the package: SublimeHaskell

4. Install Haskell tools

Cabal is the standard package manager for Haskell. What you need to do is:

  1. Start a console with administrative permissions
  2. Run:

    cabal install cabal-installcabal updatecabal install aesoncabal install haskell-src-extscabal install ghc-modcabal install cmdargscabal install haddock

5. Install hdevtools

You can NOT install hdevtools on Windows by running: cabal instal hdevtools. What you need to do instead is:

  1. Download the source code of hdevtools for Windows from https://github.com/mvoidex/hdevtools*(* Currently does not work with GHC 7.10. See this fork for building with GHC 7.10 and above)

  2. Unpack it to some folder

  3. Go to that folder and run:

    runhaskell Setup.hs configure --userrunhaskell Setup.hs buildrunhaskell Setup.hs install
  4. Watch for the path (in the console output) where the hdevtools have been installed. You will need this path when setting up the SublimeHaskell plugin in Sublime. The path should look something like this: C:\Users\Aleksey Bykov\AppData\Roaming\cabal\bin where Aleksey Bykov is the name of the current user.

6. Setting up the SublimeHaskell plugin in Sublime:

  1. Start Sublime
  2. Go Preferences >> Package settings >> SumblimeHaskell >> Settings - User
  3. Make sure you configuration looks like:

    {    "add_to_PATH":    [        "C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/"    ],    "enable_hdevtools": true}

where C:/Users/Aleksey Bykov/AppData/Roaming/cabal/bin/ is that path (you got at step 5) where hdevtools (all all other toolls have been installed)4. Save the file and restart Sublime

7. Hello world

  1. Start Sublime
  2. Create a new file and save it immediately as hello-world.hs
  3. Put the following code there:

    main::IO()main = putStrLn "Hello world!"
  4. Build and run by going Tools >> Build x 2 times (first it builds, second it runs)

8. See also

There is another great article: http://howistart.org/posts/haskell/1


I've used Haskell on Windows, but only when forced to. Not because the combination Haskell+Windows is particularly bad, but just because I don't really like Windows.

My setup was basically the following:

As you can see I was trying to get an environment that was as similar to Unix as possible (without using cygwin, because I find it utterly confusing). Vim is my favourite editor. The reason for Visual Studio was that the C environment shipped with GHC doesn't cover all of Win32API. I used CMake to get a decent build environment.


Haskell Platform is now more or less the standard distribution of haskell, and it has a windows installer.