Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 872019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:43:25+00:00 2026-05-15T10:43:25+00:00

I just started a new Haskell project and wanted to set up a good

  • 0

I just started a new Haskell project and wanted to set up a good testing workflow from the beginning. It seems like Haskell has a lot of excellent and unique testing tools and many different ways to integrate them.

I have looked into:

  • HUnit
  • QuickCheck
  • benchpress
  • HPC
  • complexity

Which all seem to work very well in their domains, but I’m looking for a comprehensive approach to testing and was wondering what has worked well for other people.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T10:43:25+00:00Added an answer on May 15, 2026 at 10:43 am

    Getting unit testing, code coverage, and benchmarks right is mostly about picking the right tools.

    • test-framework provides a one-stop shop to run all your HUnit test-cases and QuickCheck properties all from one harness.
    • Code coverage is built into GHC in the form of the HPC tool.
    • Criterion provides some pretty great benchmarking machinery

    I’ll use as a running example a package that I just started enabling with unit testing, code coverage, and benchmarks:

    http://github.com/ekmett/speculation

    You can integrate your tests and benchmarks directly into your cabal file by adding sections for them, and masking them behind flags so that they don’t make it so that every user of your library has to have access to (and want to use for themselves) the exact version of the testing tools you’ve chosen.

    http://github.com/ekmett/speculation/blob/master/speculation.cabal

    Then, you can tell cabal about how to run your test suite. As cabal test doesn’t yet exist — we have a student working on it for this year’s summer of code! — the best mechanism we have is Here is how to use cabal’s user hook mechanism. This means switching to a ‘Custom’ build with cabal and setting up a testHook. An example of a testHook that runs a test program written with test-framework, and then applies hpc to profile it can be found here:

    http://github.com/ekmett/speculation/blob/master/Setup.lhs

    And then you can use test-framework to bundle up QuickCheck and HUnit tests into one program:

    http://github.com/ekmett/speculation/blob/master/Test.hs

    The cabal file there is careful to turn on -fhpc to enable code coverage testing, and then the testHook in Setup.lhs manually runs hpc and writes its output into your dist dir.

    For benchmarking, the story is a little more manual, there is no ‘cabal benchmark’ option. You could wire your benchmarks into your test hook, but I like to run them by hand, since Criterion has so many graphical reporting options. You can add your benchmarks to the cabal file as shown above, give them separate compilation flags, hide them behind a cabal flag, and then use Criterion to do all the heavy lifting:

    http://github.com/ekmett/speculation/blob/master/Benchmark.hs

    You can then run your benchmarks from the command line and get pop-up KDE windows with benchmark results, etc.

    Since in practice you’re living in cabal anyways while developing Haskell code, it makes a lot of sense to integrate your toolchain with it.

    Edit: Cabal test support now does exist. See http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/developing-packages.html#test-suites

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started a new project and wanted to use HaskellDB in the beginning.
I am new to functional programming and just switched from haskell (Didn't like it
I just started a new project which has previously been developed in Eclipse. I
I have just started a new project, and I am using the Delphi 2009
I just started using the new Eclipse 4.2 (Juno) Null Analysis. On code like
I've just started a brand new rails project and the first task I'm trying
I've just started at a new communications company, and we're looking at a workflow
We just started a new project in Java EE in our office and i
I just started a new project, and now with ASP.NET MVC being designed in
I've just started a new project in ASP.net 4.0 with MVC 2. What I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.