shivamashtikar / haskell-setup

Haskell setup for vscode with cabal and nix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

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.

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.

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.

Integrates vscode with ghcid

This will help you format your code. Will make more readable and preety.

Another code formatter for Haskell.

Support for the Haskell programming language in visual studio code.

It indexes your whole project and provides useful suggestions.

Makes hoogle search easier.

highlight trailing spaces.

Fonts

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

Code Code

About

Haskell setup for vscode with cabal and nix


Languages

Language:Vim Script 100.0%