Get started

Welcome, new Haskeller! Read on to quickly set up your Haskell development environment, execute your first lines of code, and get directions for further learning.


Set up a Haskell development environment

A complete Haskell development environment consists of the Haskell toolchain (compiler, language server, build tool) and an editor with good Haskell support. The quickest way to get this set up is to:

  1. Use GHCup to install and manage the Haskell toolchain.
  2. Use VSCode as the editor, with the Haskell extension installed.

GHCup: universal installer

GHCup is a universal installer for Haskell that will install everything you need to program in Haskell, and will help you manage those installations (update, switch versions, …). GHCup does not require root/admin access. Follow the instructions on the GHCup webpage to install GHCup. Then use it to install the Haskell toolchain, which consists of:

  1. GHC (The Haskell compiler) We will use GHC below to run our examples, but in practice you will mostly use a tool like Cabal or Stack to build your code, instead of GHC directly.
  2. HLS (The Haskell Language Server) You won’t use HLS directly, instead your code editor will use it in the background to provide you with a great experience while editing Haskell code.
  3. Cabal (A Haskell build tool) You will use Cabal to structure your Haskell projects, build them, run them, define dependencies, … .
  4. Stack (A Haskell build tool) An alternative to Cabal.

Cabal and Stack: which one should I install?

We recommend installing both. Most Haskell projects can be built using Cabal, but some might require Stack. Installing both guarantees that you can use either, and while following a tutorial or book you can use whatever they recommend.


Visual Studio Code (VSCode) is a popular choice with well-supported Haskell integration. Install the Haskell extension and you are all set. It should work out of the box and use your installation of HLS. To learn about support for other editors, check out HLS docs for editor configuration.

Running your first lines of code

We have everything set up, let’s use it! The Haskell compiler, GHC, comes with an interactive interpreter called GHCi which is great for playing with Haskell and trying things out, so let’s give it a spin. Run ghci at your command prompt, which will start a new GHCi prompt for you. Let’s do a simple calculation to check Haskell’s computing capabilities:

> 6 + 3^2 * 4

42 is a nice even number, but what about the first 10 even numbers after it?

> take 10 (filter even [43..])

What is the sum of those?

> sum it

NOTE: We used a special feature of GHCi here, which is a special it variable that remembers the result of the last expression.

Great, you got the first taste of Haskell! Now let’s get to running a real program.

Writing your first Haskell program

In your editor, create a new file named hello.hs. Write the following in it:

main = do
  putStrLn "Hello, everybody!"
  putStrLn ("Please look at my favorite odd numbers: " ++ show (filter odd [10..20]))

You can now compile it with ghc to produce an executable called hello that we will then run:

> ghc hello.hs
> ./hello
Hello, everybody!
Please look at my favorite odd numbers: [11,13,15,17,19]

There you go, you just wrote a short, polite program in Haskell!

GHCI TIP: You can also load your file directly into ghci, which will enable you to play with any functions and other definitions you defined in it. So for our example, we can just load hello.hs with GHCi and then call the function main like this:

> ghci hello.hs
GHCi, version 8.10.7:  :? for help
[1 of 1] Compiling Main             ( hello.hs, interpreted )
Ok, one module loaded.
> main
Hello, everybody!
Please look at my favorite odd numbers: [11,13,15,17,19]

Participate in the community

By participating in the Haskell community, you will be able to ask for help and learn about new developments in the Haskell ecosystem. Some of the most popular places to interact with the community are:

We recommend joining right now, and don’t be shy to ask for help! Check for a full list of resources relating to the Haskell community.

Next steps

Popular free learning resources for beginners:

This is just the tip of the iceberg though: check Documentation for a bigger list of learning resources. That is it, fellow Haskeller! Enjoy learning Haskell, do (not?) be lazy and see you in the community!