Skip to content

Easy instructions for setting up Haskell editors / IDEs on any major operating system.

License

Notifications You must be signed in to change notification settings

freeman42x/haskell-editor-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions for setting up Haskell editors / IDE

HIE together with compatible plugins usually offers more features than the average Haskell multi-feature plugin + compatible plugins. Some exceptions are: IntelliJ IDEA which has a very good set of features (and HIE does not have an IDEA plugin yet) and Leksah (which also does not have a HIE plugin but offers quite a lot of features itself).

To see a list of Haskell IDE Engine features see: HIE features

For a list of editor / IDE features see: rainbyte/haskell-ide-chart

Choose your operating system and continue the steps required for it:

  • Windows
  • Windows using WSL
  • Windows using VMWare with Linux virtual machine
  • Linux
  • MacOS

Windows

Install Git

  • download Git from here
  • install it

Enable Win32 long paths

On Windows Professional

  • Type Windows key, type gpedit.msc and press Enter.
  • Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem
  • Double click on Enable Win32 long paths
  • Click on Enabled
  • Click on OK
  • Close Local Group Policy Editor
  • Reboot your operating system

On Windows Home or Starter

  • Open the registry patch file
  • Right click in the opened registry file and click on Save as... and save it with extension .reg
  • Double click it and choose Yes
  • Reboot your operating system

Install the Haskell Tool Stack

  • download Haskell Stack installer
  • install Haskell Stack through the installer, the default settings should be fine

Install Haskell IDE Engine

  • press Win+E
  • open the root of one of your drives where you want to clone Haskell IDE Engine
  • right click in the folder and click on Git Bash Here
  • clone Haskell IDE Engine with: git clone https://github.com/haskell/haskell-ide-engine.git
  • run cd haskell-ide-engine
  • run stack ./install.hs hie-8.6.5 asynchronously (go graba cup of coffee, or do something else while it installs, etc. - it will take a while, took 44m 43s for me)
  • run stack ./install.hs data

Install Nix on your operating system

Nix is a package manager that is very good at doing successful installs.

If you require any system level libraries to use in the project you are working on it is recommended to use Nix to provide them and then do your development inside a nix-shell.

Doing Haskell development on Windows is not recommended since many Haskell packages have issues building on Windows. For doing development while using Widnows as your OS the recommended options are to use either a VMWare virtual machine (preferred) or Windows Subsystem for Linux (unrecommended since the build times are much slower).

Developing on Linux or MacOS should work fine.

To install Nix in your OS run:

curl https://nixos.org/nix/install | sh

Install GHC and cabal-install

Create the file ~/.config/nixpkgs/config.nix and copy paste this into it:

with import <nixpkgs> {};

{
  allowUnfree = true;

  packageOverrides = pkgs: rec {
    all = pkgs.buildEnv {
      name = "all";

      paths = [
        haskell.compiler.ghc865
        haskellPackages.cabal-install
        binutils.bintools # required on WSL
      ];
    };
  };
}

And run following command to install the GHC and cabal-install packages:

nix-env -i all

Install the editor / IDE of your choice

Editors that are easy to set up are Atom, Visual Studio Code, IntelliJ IDEA Community or Sublime Text 3.

Editors / IDEs list and their Nix package name:

  • Atom - atom
  • Visual Studio Code - vscode
  • Emacs - emacs
  • Spacemacs - emacs (and then install the spacemacs layer)
  • Neovim - neovim
  • Vim - vim
  • Leksah - install instructions
  • IntelliJ IDEA Community - jetbrains.idea-community
  • Sublime Text 3 - sublime3

To install:

  • pick your editor(s) from the list above
  • add the editor(s) Nix package name(s) to the packages list inside ~/.nixpkgs/config.nix
  • run nix-env -i all to install the editors you chose

Continue with:

Install Haskell IDE Engine executable

In ~/.config/nixpkgs/config.nix add to the let variables:

all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};

and add following to the list of packages - change the GHC list to the ones you will want to have available (eg. ghc865 or ghc865 ghc864 ghc843):

(all-hies.selection { selector = p: { inherit (p) ghc865; }; })

if you wish to install HIE for all GHC versions because you switch between projects with different GHC versions a lot then you can use this instead:

(all-hies.selection { selector = p: p; })

installing all HIE versions will take a long time to install

after adding HIE your configuration should look something like the following:

with import <nixpkgs> {};

let
  all-hies = import (fetchTarball "https://github.com/infinisil/all-hies/tarball/master") {};
  unstable = import <nixpkgs> { inherit config; };
in
  {
    allowUnfree = true;

    packageOverrides = pkgs: rec {
      all = pkgs.buildEnv {
        name = "all";

        paths = [
          binutils.bintools # required on WSL
          haskell.compiler.ghc865
          haskellPackages.cabal-install
          unstable.haskellPackages.stack
          unstable.haskellPackages.cabal2nix
          haskellPackages.hoogle
          haskellPackages.ghcid
          (all-hies.selection { selector = p: { inherit (p) ghc865; }; })
        ];
      };
    };
  }

run nix-env -i all to install HIE

Install the extensions for your editor / IDE that help with Haskell development

  • nix
  • language-haskell
  • atom-ide-ui
  • ide-haskell-hie (Haskell IDE Engine)
  • ide-haskell-repl
  • autocomplete-haskell
  • hasklig
  • ide-haskell-hoogle
  • ide-haskell-cabal
  • ide-haskell-hasktags
  • Nix
  • Haskell Syntax Highlighting
  • Haskell Language Server (Haskell IDE Engine)
  • haskell-ghcid
  • hoogle-vscode
  • Hasklig - ligatures for Haskell code

Installing Hasklig fonts on Windows:

  • press Win+X
  • press A to start cmd as administrator
  • run @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" to install the package manager Chocolatey
  • run choco install hasklig to install the Hasklig fonts on your operating system

Enabling Hasklig fonts:

  • open Visual Studio Code

  • type Ctrl+Shift+P

  • type setting

  • open Preferences: Open Settings (JSON)

  • make sure you have the following in your settings:

    • "editor.fontFamily": "Hasklig"
    • "editor.fontLigatures": true

Alternatives to HIE:

  • Haskelly
  • Haskero
  • Simple GHC

Alternatives to HIE:

  • jyp/dante (intero fork)
  • chrisdone/intero
  • flycheck/flycheck-haskell
  • haskell/haskell-mode
  • nominolo/scion
  • DanielG/ghc-mod
  • emacs-lsp/lsp-haskell (Haskell IDE Engine)
  • haskell/haskell-mode

Alternatives to HIE:

  • Haskell layer (uses intero)

Alternatives to HIE:

  • chrisdone/intero
  • parsonsmatt/intero-neovim

Alternatives to HIE:

  • vim-syntastic/syntastic
  • dense-analysis/ale
  • IntelliJ-Haskell
  • HaskForce
  • HoogleIt
  • LSP (Haskell IDE Engine)

Alternatives to HIE:

  • SublimeHaskell
  • dariusf/sublime-intero

About

Easy instructions for setting up Haskell editors / IDEs on any major operating system.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published