- Install GHCup, this will manage all of your Haskell development tools. Follow the onscreen instructions. When it asks you if you'd like to install Haskell language server, say yes.
- Install the Haskell extension for VSCode. This is the front end for the Haskell Language Server (hls). If you'd like to use hls with another editor of your choice (any editor with lsp support), see this section of the hls documentation.
- Navigate to an empty directory on the command line. Run
cabal init
. This will create 3 files:- A Changelog (you can ignore this for now)
- A
*.cabal
file where*
is the name of your cabal project (this defaults to the name of the directory you rancabal init
in). This file defines the structure of your project and which dependencies it uses. - An example source file,
app/Main.hs
. This is the entrypoint to your program.
- Run
cabal run
to compile and run your program. If all goes well, it should printHello, Haskell!
. - To run a GHCi session in the context of your project, run
cabal repl
.
- GHC: The Glasgow Haskell Compiler, this is the program that turns Haskell (
*.hs
) source files into machine code. - GHCi: The GHC interactive environment. This is a tool for quickly evaluating expressions and interpreting programs in an interactive manner.
- GHCup: The Haskell toolchain installer. This tool manages all the other tools you need to develop Haskell programs (GHC, Cabal, and HLS). Fun fact: If you're on Linux/Mac, you can run
ghcup tui
for a neat terminal UI. - Cabal: The Haskell build tool. This is a tool for building Haskell projects that may consist of more than 1 source file, and may have external dependencies from Hackage.
- Hackage: The Haskell package repository. This is an external repository that hosts a large number of open source Haskell packages. You can browse Hackage packages here.
- Haskell Language Server (HLS): The Haskell editor support backend. This tool is the backend for the Haskell IDE support in VSCode and other LSP-enabled editors.