My Haskell Setup

TL;DR: I use direnv to add stack path --bin-path directories to project-specific PATH variable. I also only use Stackage LTS which has ghc-mod as part of the distribution.

  • Install Stack using: curl -sSL | sh
  • Install Atom using the .deb file they provide.
  • Install direnv using: sudo apt install direnv
  • Add the following line at the end of the ~/.bashrc file: eval "$(direnv hook bash)"
  • Run apm install language-haskell haskell-ghc-mod ide-haskell-cabal ide-haskell autocomplete-haskell ide-haskell-repl
  • Find the latest LTS Stackage distribution that has ghc-mod in it using this page. In my case it is LTS Haskell 8.24, use that for all stack installations and new projects. Without ghc-mod your development will be very slow even if you have a newer GHC compiler.
  • Use the above Stackage version to install the following compiler tools and copy them to your stack’s compiler tools directory: stack build --copy-compiler-tool --resolver lts-8.24 hlint stylish-haskell hasktags hoogle intero ghc-mod
  • Create your stack project as usual. e.g. stack new my-project --resolver lts-8.24
  • Create .envrc file in your project directory with the following content in it: export PATH=$(stack path --bin-path)
  • Run direnv allow . in your project directory so that .envrc is used.
  • Run stack test --fast --haddock-deps --file-watch and keep it running while you develop.
  • Open your project in atom, and everything should work without further changes to settings.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s