Set up Atom.io for developing Haskell on OS X
Posted on March 26, 2016
This is a step by step guide to setup Atom.io for developing Haskell on OS X (El Capitan). It highlights some extra configuration notes to avoid any issues I had today.
Screenshot
If you will finish all the steps you should be able to do write some fancy Haskell stuff with Atom.io like a Pro :-)
1. Preconditions
First of all we have to install ghc, which is the Glasgow Haskell Compiler and cabal as a package system for Haskell. We are using brew to install both on OS X as follow:
brew install ghc
brew install cabal-install
2. Install Cabal packages
Now we do need to install following cabal packages:
- happy is a parser generator for Haskell
cabal install happy
- ghc-mod is a backend program to enrich Haskell programming in editors.
cabal install ghc-mod
- stylish-haskell is a Haskell code prettifier.
cabal install stylish-haskell
3. Install and setup Atom packages
Finally we have to install all needed Atom packages by opening Atom -> Settings View -> Install Packages and Themes
.
Please note: Some of following packages are depending on each other. That's why it is recommended to install all together.
If there a need of setting a custom configuration option it will be highlighted as custom configuration
it the following list. After a package is installed You can set this custom option opening Atom -> Settings View -> Packages -> {your package} - Settings
.
Ok, lets start to install and setup the following packages:
- ide-haskell Haskell IDE
# absolute path to stylish-haskell
"Stylish Haskell Path": /Users/{username}/.cabal/bin/stylish-haskell
If you are unsure what the path to stylish-haskell
is, just check it as follow:
which stylish-haskell
language-haskell Haskell language support in Atom
ide-haskell-cabal Provides Cabal backend for ide-haskell
# version of GHC
"Active GHC version": 7.10
You can check your installed ghc
version as follow:
ghc --version
It should be output something like this:
The Glorious Glasgow Haskell Compilation System, version 7.10.3
- autocomplete-haskell Autocomplete-plus provider for haskell
# name of the backend to use
"Use Backend": haskell-ghc-mod
- haskell-ghc-mod Provides backends for
ide-haskell
andautocomplete-haskell
# path to directory of cabal's binaries
"Additional Path Directories": /Users/{username}/.cabal/bin/
The location of cabal
can be found by:
which cabal
- ide-haskell-repl Haskell REPL support for ide-haskell
# any REPL command, not needed by ghci
"Command Args": none
# path to ghci (GHC interpreter)
"Command Path": /usr/local/bin/ghci
To get the location of ghci
just check it with:
which ghci
We are done! I hope you will have a nice Haskell running Atom editor right now :)
4. Questions?
If you have any questions or improvements, feel free to leave a comment or tweet to me @sectore
Have fun!
-Jens