My Haskell IDE Setup with cabal and nix
An inteligent IDE makes development a child’s play. In a strongly typed environment, being able infer types
while coding makes life haven!
I use vscode
for most of the development and somtimes nvim
. Projects I work on are usually build with nix
+ cabal
, so I needed plugins which will extract the capabilities of nix
as well.
Plugins
Follwing are the plugins list for vscode
for haskell projects.
direnv
It let us load and unload environment variables depending on the current directory.
After installing bot direnv
executable and vscode plugin, follow this instructions to add use_nix
function in ~/.direnvrc
. Then under your projects root folder create a .envrc
file which will only have
use_nix -s shell.nix
Here is how my ~/.direnvrc looks like. Next time you open your project, vscode will automatically load nix
environment for you.
ghcide
It provides all the necessary functionality that we need. It displays type
, dignostics
, jump to definition
and quick fixes
features. After installing executable and plugin you will be able to see type and definition.
haskell-linter
It highlights hlint warnings and errors inline and provides a code-action to accept hlint suggestions. You need to install hlint
for this plugin. You can also add .hlint.yaml
in your projects root directory.
haskell-ghcid
Integrates vscode with ghcid
Haskell Code Formatter
This will help you format your code. Will make more readable and preety.
stylish-haskell
Another code formatter for Haskell.
Haskell Syntax Highlighting
Support for the Haskell programming language in visual studio code.
TabNine
It indexes your whole project and provides useful suggestions.
hoogel-vscode
Makes hoogle search easier.
Trailing Spaces
highlight trailing spaces.
Fonts
Fira Code
Monospaced font with programming ligatures
Aditional
-
If you use
zsh
then you can add this plugin zsh-nix-shell which will lets you use zsh in nix-shell shell -
Here is my .nvimrc and .nvimrc.plug with haskell plugins.
Screenshots