Skip to content
Solutions to Project Euler problems using Haskell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Haskell solutions to Project Euler problems

This repository uses Cabal for building and testing.

Installing Haskell setup

Glasgow Haskell Compiler

Install a recent version of Glasgow Haskell Compiler.

The preferred method is to install the Haskell Platform.


Even if you already have Cabal, you should make sure to have the latest version.

$ cabal update
$ cabal install cabal-install


Set up your PATH, e.g., append to .bash_profile.

$ export PATH="$HOME/Library/Haskell/bin:$PATH"

Building and running the Project Euler project

Configure and install dependencies

$ cabal configure --enable-tests

You may need to install dependencies, e.g.,

$ cabal install HUnit
$ cabal install QuickCheck
$ cabal install test-framework
$ cabal install test-framework-hunit
$ cabal install test-framework-quickcheck2
$ cabal install test-framework-th

Build and test

We are using test-framework for testing, wrapping around the QuickCheck and HUnit frameworks.

Also, we use test-framework-th, a nice wrapper using Template Haskell to simplify the writing of test cases.

$ cabal build && cabal test


Run the sample executable:

$ dist/build/answer1/answer1

View the Haddock documentation

To illustrate the Haddock documentation system, some annotations have been added to the code.

$ cabal haddock

Open up dist/doc/html/project-euler-haskell/index.html in your Web browser to view the generated documentation.

More documentation

Use Hoogle to search for stuff.

You can’t perform that action at this time.