Haskell solutions to Project Euler problems
This repository uses Cabal for building and testing.
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"
$ 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
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
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.
Use Hoogle to search for stuff.