Get Started

Quick steps to get up and running with Haskell.

1 Download Haskell Stack

Choose your operating system:

With the Haskell Stack you get a comprehensive development environment for Haskell:

  • Stack: A project builder for multi-package Haskell projects.
  • GHC: A compiler and interpreter for Haskell programs.
  • Haddock: A documentation generator for Haskell packages.
  • And thousands of packages installed on demand.

2 Running Haskell programs

To quickly run a Haskell script:

  1. Copy the following content into a file called HelloWorld.hs:

    #!/usr/bin/env stack
    -- stack --install-ghc runghc
    
    main :: IO ()
    main = putStrLn "Hello World"
  2. Open up a terminal and run stack HelloWorld.hs.

Done!

Start on a proper Haskell package. Run the following in your terminal:

Terminal
$ stack new new-project $ cd new-project $ stack build $ stack exec new-project-exe

You can now edit the source files in this directory (see the file src/Lib.hs), and rebuild and run the project with stack build and stack exec new-project-exe as above.

3 Next steps

Congratulations, you're setup to start writing Haskell code! We've broken down next steps into a few common workflows with Stack. If you're not sure where to start, we recommend reading them in order.