Skip to content

Instantly share code, notes, and snippets.

@s0kil
Last active February 24, 2021 15:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s0kil/21b19c06a20bda6256b55fcf75da68d3 to your computer and use it in GitHub Desktop.
Save s0kil/21b19c06a20bda6256b55fcf75da68d3 to your computer and use it in GitHub Desktop.
Setting Up VS Code purple-yolk Extension With IHP

Integrating purple-yolk With IHP

  • In your IHP project directory, create a file named .ghci-purple-yolk and copy the contents of the .ghci file
  • Add :l Main.hs to the end of the .ghci-purple-yolk file

.ghci-purple-yolk should look something like:

:set -XNoImplicitPrelude
:def source readFile
:source build/ihp-lib/applicationGhciConfig
import IHP.Prelude
:l Main.hs
  • In your VS Code settings, set the purple-yolk.ghci.command property to ghci -package-env - -ddump-json -ignore-dot-ghci -ghci-script .ghci-purple-yolk

  • It should look like: "purple-yolk.ghci.command": "ghci -package-env - -ddump-json -ignore-dot-ghci -ghci-script .ghci-purple-yolk",

  • Reload VS Code, it should be good to go!

  • Recommended, enable the Haskell HSX extension.

Benefits of using purple-yolk over Haskell Language Server (HLS)

  • Smaller memory footprint, HLS uses up to 5GB of memory per IHP project where purple-yolk (ghci) uses around 700MB
  • Faster startup, HLS takes a couple of minutes to scan a project before autocompletion/error reporting is available.
  • Instant reload, purple-yolk uses ghci, so reloading changes is very fast.

Drawbacks

  • purple-yolk does not yet support autocompletion, at the moment, it simply highlights compilation errors in the editor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment