Building a Haskell Project

What This Guide Covers #

For Language versions and other build-environment specific information visit our reference pages:

The rest of this guide covers configuring Haskell projects on Travis CI. If you’re new to Travis CI please read our Tutorial and build configuration guides first.

Specifying Haskell compiler versions #

The Haskell environment on Travis CI has recent versions of GHC (Glasgow Haskell Compiler) pre-installed. For a detailed list of pre-installed versions, please consult “Build system information” in the build log.

You can specify one or more GHC versions using major.minor notation. Patch level versions (7.6.2 for example) may change any time:

language: haskell
ghc:
  - "7.10"
  - "7.8"
  - "7.6"
  - "8.4.1"

Dependency Management #

By default Travis CI uses cabal to manage your project’s dependencies:

cabal install --only-dependencies --enable-tests

Specifying cabal-install verison #

You can specify the version of cabal used:

language: haskell
cabal: "2.4"
ghc:
  - "8.6.4"

Multiple Packages in Subdirectories #

If you have multiple packages in subdirectories (each containing a .cabal file, you can specify those directories in an environment variable:

language: haskell
ghc:
  - "7.10"
  - "7.8"
  - "7.6"
env:
  - PACKAGEDIR="some-package"
  - PACKAGEDIR="some-other-package"
before_install: cd ${PACKAGEDIR}

The build matrix is then constructed such that each package is compiled with each version of GHC.

Hackage Deployment #

Travis can automatically upload your package to Hackage. See Hackage Deployment.

Build Config Reference #

You can find more information on the build config format for Haskell in our Travis CI Build Config Reference.

Build with Stack #

Check out Travis CI on Stack if you want to use Stack to build your project.