This post aims to compliment the PureScript Compiler Developer’s Guide with a direct set of instructions for getting an IDE setup for Haskell development.
Here are instructions for getting VSCode + HIE backend configured.
Feel free to contribute instructions for your preferred IDE.
This needs to be built from source. You should also take a look at the readme to check for any OS-specific instructions. These steps for for Ubuntu 20.04.
Clone the code:
git clone https://github.com/haskell/haskell-ide-engine --recurse-submodules cd haskell-ide-engine
Find the GHC version that your branch of the PureScript compiler is using. This requires navigating to the compiler’s source directory and running:
$ stack ghc -- --version The Glorious Glasgow Haskell Compilation System, version 8.6.5
Note that this version will likely be different if this command is run from another location, such as your home directory.
Then, back in the
haskell-ide-engine source directory, install for that version of the compiler. For example:
stack ./install.hs hie-8.6.5
This command will take a while to complete.
You can then optionally generate a Hoogle database to provide pop-up documentation when hovering over a symbol in VSCode. Run this command from the same
stack --stack-yaml=stack-8.6.5.yaml exec hoogle generate
hlint for warnings/errors,
apply-refact for quick-fix suggestions, and
brittany for code formatting. If these tools are installed, then their additional functionality will be picked-up by the VSCode extension.
stack install hlint apply-refact brittany
Then launch VSCode from the root of the PureScript compiler directory.
cd <purescript compiler directory> code .
You can read more about the available extension features here.