Electric Sheep

Haskell with Visual Studio Code

January 20, 2020

Installing Haskell

Head to haskell.org and download a copy of the minimal installer for your platform.

This will install the core Haskell libraries, GHC (The Glasgow Haskell Compiler), cabal and Stack.

Visual Studio Code Setup

Syntax Highlighting

For our first addition, open your VS Code extensions and search for Haskell, towards the top of the list (if not at the top) you will see Haskell Syntax Highlighting.

Completions et al.

To keep this simple we are going to leverage GHC directly with a great plugin Simple GHC (Haskell) Integration. It provides diagnostics, completion, types, an inline REPL, definitions, and usages.


To enable debugging within the VS Code debugger, lets first install a couple of stack packages:

$ stack install phoityne-vscode haskell-dep

Now we can wire up to VS Code with Haskell GHCi Debug Adapter Phoityne. When you are in a Haskell project you can select VS Codes’ debugger and create a new launch.json based on the haskell-debug-adapter option. Within the launch.json you can change your startup file to hit Main.hs if you like. Starting the a debug session should let you breakpoint and debug now.