Skip to content

1. Setup

Anurudh Peduri edited this page Oct 30, 2020 · 5 revisions

My Setup

I use neovim with coc.nvim, and the ALE plugin for linting. Here is a nice article on setting up: Haskell + Vim.

The article is somewhat old, and Haskell now has a new LSP: haskell-language-server. This unfortunately doesn't support HLint as of now, so I use the ALE plugin for that.

GHC

GHC is the standard compiler for Haskell.
Basic compiling example: ghc -o a.out -Wall <file.hs> (notice the similarity to gcc)

Here is the Haskell Platform installation. It's probably the easiest way to install Haskell.

Linter

HLint is the standard lint tool for Haskell.
Once installed, you can invoke it using hlint <file>.hs

The linter shows very useful warnings and possible rewrites to make the code cleaner and elegant.

REPL

GHCi is the interactive environment for GHC.
Once installed, you can fire up the interactive session using ghci

Basic CP Template

import Control.Arrow

main :: IO ()
main = interact $ ... -- interact takes a function of the type `String -> String`

Other Suggestions

I used to use VSCode with the Haskell plugin. It supports formatting and live analysis.
I switched to neovim + coc because VSCode was way too slow.

Clone this wiki locally