There are several excellent posts about setting up the Haskell development environment. One of the best ones is Tony Lawrence’s Configuring Your Haskell Environment. I encourage you to take a look at his post first.
Tony’s post is more than a year old though, and it looks like a couple of things have changed since he wrote his post, especially with the latest version of Haskell and SublimeHaskell. I wasted a good chunk of time trying to get around those problems, so now writing this post in case others run into similar issues when setting up the SublimeHaskell plugin.
Here’s a summary of the steps to setup the Haskell dev environment (from Tony’s blog).
- Install the Haskell platform.
cabal updateto update the list of available packages for Haskell.
- Install the requisite packages by issuing
cabal install aeson haskell-src-exts haddock hdevtools.
- Install Sublime Text 3.
- Install Package Control for Sublime Text 3.
- Install SublimeHaskell via Package Control.
This last step doesn’t work seamlessly. When I installed SublimeHaskell, I ran into the following error message in Sublime Text:
1 2 3 4 5
The problem is described in more detail in issue #182 on SublimeHaskell’s GitHub page. The summary is that the master branch of SublimeHaskell is too slow to accomodate the removal of
haskell-src-exts. The solution is to use the
hsdev branch of SublimeHaskell. This is done as follows (recommended by MoreAxes on comment thread for issue #182):
- In Sublime Text, launch Package Control (
cmd-shift-p), and use the ‘Add Repository’ command to add
- Install SublimeHaskell with Package Control normally. Package Control looks in user-defined repositories first, so it is able to get SublimeHaskell from the
- Restart Sublime Text.
You can now enter and build Haskell code from Sublime Text. To verify your setup, enter the following code in Sublime Text, and then hit
1 2 3
You will see the following printed:
Here’s a screenshot of my test file, with the output of the program: