Skip to content

Instantly share code, notes, and snippets.

@mpickering
Last active July 25, 2019 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpickering/68ae458d2c426a29a7c1ddf798dbc793 to your computer and use it in GitHub Desktop.
Save mpickering/68ae458d2c426a29a7c1ddf798dbc793 to your computer and use it in GitHub Desktop.
Try haskell-ide-engine on GHC

These are instructions about how to use the experimental support for haskell-ide-engine on GHC.

Note that this will only work whilst editing the main compiler currently, it won't work with subcomponents or hadrian. That's future work.

  1. Build this branch using cabal new-build - https://github.com/mpickering/haskell-ide-engine/tree/hie-bios
  2. Install the "Haskell Language Server" extension in vscode
  3. Set the "Hie Executable Path" to the executable you just built
  4. Disable "Diagnostics on Change" - It's too slow to work on GHC.
  5. Create a hie.yaml file in the root directory with the following contents:
cradle: {bios: {program: "hie-bios"}}
  1. Create an executable file in the root directory called hie-bios
#! /usr/bin/env bash
echo $(TERM=dumb CABFLAGS=-v0 ./hadrian/build.cabal.sh tool-args -q --build-root=_ghci --flavour=ghc-in-ghci) -ighc ghc/Main.hs
  1. Execute the hie-bios file in your terminal - it should take 1-2 minutes before printing out some options. This is a testing step to see everything is set up properly.

  2. Open the GHC folder in vscode and open a file such as compiler/utils/FV.hs. After a short period editor features should work. Try hovering, going to definition, finding references and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment