IDE-Haskell is a plugin for the Atom editor and it opens automatically whenever you open a haskell source file.

Combine it with language-haskell, haskell-ghc-mod, autocomplete-haskell and you get a great IDE with support for autocompletion and linter for your Haskell projects

Suggested Atom packages:

The installation process has two steps. The first one is to install ghc-mod, hlint and stylish-haskell. The second one is the installation of atom packages.

You can modify the apm command to include or remove packages as you wish.

stack install ghc-mod hlint stylish-haskell
apm install language-haskell haskell-ghc-mod ide-haskell autocomplete-haskell

Issues with yesod devel

ghc-mod will fail if it sees a dist/ directory which is made when you run your yesod projectt via stack exec yesod devel.

The workaround, until yesod-bin is updated to use Stack directly, is to delete the /dist directory and instead of yesod devel, run the application via ghci.

GHCI and auto-reload

To reload an application inside a ghci session we need to enter three commands:

# when opening the session to load everyithing needed.
:l app/DevelMain.hs

# to reload the application
:l app/DevelMain.hs

We use :l app/DevelMain.hs instead of :reload because the former doesn’t reload shakespeare templates.

Entering those commands manually every time we want to reload the application can be very tedious but we can make our lives easier.

Modify the .ghci file by including these lines onto the end of the file:

:l app/DevelMain.hs
:def hoge const $ return $ unlines ["DevelMain.shutdown",":l app/DevelMain.hs","DevelMain.update"]

Then run the application via ghci:

stack ghci
#only necessary when starting ghci
:l app/DevelMain.hs
# execute everytime you change a file or when you want to reload the application.