-
Install ghcid with
cabal install ghcid
-
Add the ghcid neovim plugin to ~/.config/nvim/init.vim:
Plugin 'ndmitchell/ghcid', { 'rtp': 'plugins/nvim' }
-
Close neovim and reopen it and run
:PluginInstall
to install the plugin. -
Open a stack project in neovim and open a Haskell file (a file with a .hs extension)
-
Run Ghcid with
:Ghcid --restart=[project].cabal -c "stack repl --ghci-options=-fno-code"
where[project]
is the name of the project. If you want to load tests (but not load the app/Main module), run:Ghcid
. -
Now whenever you add new files or update the dependencies, open a new terminal in neovim and run
stack build
. Ghcid will automatically restart and watch the new modules/dependencies. -
To delete a module you have to follow these steps:
- Edit the
[project].cabal
file and remove the modules that you want to delete - Delete the files/directories which correspond to the deleted modules
- Delete the
[project].cabal
file - Run
stack build
- Edit the
Last active
August 1, 2018 03:13
-
-
Save DarinM223/0d166e259a3dd90921e380a27ca0baba to your computer and use it in GitHub Desktop.
Autoreload workflow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment