Mathematics utilities for Haskell

Latest on Hackage:0.9.2

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

MIT licensed by Luis Rodrigues Soares
Maintained by

Euler - Mathematics functions for Haskell.

Build Status

What is this?

This repo contains functions to help in mathematics calculations or puzzles using Haskell. Currently there is only one module, Numeric.Euler.Primes, which contains implementations of three prime number sieves:

The current major version (0) is stable enough to be used for Project Euler problems but keep in mind that the sieves are still not optimized at all. I've been mostly busy trying to make a stable build.

You can also find this package in Hackage.

Dependencies and building

To install the library you just need the latest base, so GHX 7.8 should be more than enough. Just cabal install euler from you project or add euler as a dependency to your .cabal file and you should be good to go.

If you want to build the library locally, you'll need a few more things:

Building with cabal

You'll need:

  • GHC >= 7.8
  • cabal-install == 1.22.*
  • happy == 1.19.* to run HLint

cabal-install will take care of installing all the other dependencies. Happy is an executable so you need to get either to you user space or through you OS package manager. You then build it like this:

git clone
cd euler
cabal sandbox init
cabal install --only-dependencies --enable-tests --enable-benchmarks --enable-library-coverage
cabal build
cabal test
cabal bench

Building with runhaskell

You'll need:

  • happy == 1.19.* and hlint == 1.9.* to run HLint;
  • hspec == 2.1.* to run the unit tests;
  • xml == 1.3.* to run the unit test coverage;
  • regex-posix == 0.95.* to run the documentation coverage;
  • criterion == 1.0.2.* to run the benchmarks.

You need to get these yourself since building it with runhaskell will not get these dependencies for you. As far as I know. You then build it like this:

runhaskell Setup.hs configure --enable-tests --enable-library-coverage --user
runhaskell Setup.hs build
runhaskell Setup.hs test
runhaskell Setup.hs bench

Happy hacking! :-)


Change Log

0.9.2 Luis Rodrigues Soares Apr 16 2015 Removes logging information. Builds with GHC 7.10.

0.8.1 Luis Rodrigues Soares Mar 19 2015 Logs more information while running. Documentation update.

0.8.0 Luis Rodrigues Soares Mar 15 2015 Adds examples of build scripts that use both cabal and runhaskell; Makes the HPC script more resilient to a build done with cabal vs a build done with runhaskell; * Removes dependency on cabal for the haddock phase.

0.7.0 Luis Rodrigues Soares Mar 13 2015 * Fixes for HPC test-suite.

0.6.0 Luis Rodrigues Soares Mar 7 2015 Makes happy a required build tool; Fixes GHC warnings.

0.5.0 Luis Rodrigues Soares Mar 7 2015 Adds; Adds Criterion benchmarks; * Adds support for travis build.

0.4.0 Luis Rodrigues Soares Mar 6 2015 Adds full documentation to the Primes module; Made the default haddock threshold become 100%; Brought down the limit for prime number generation during spec test phase; Removed temporary files; Updated dependencies; Changed formatting; Made script to run documentation; Makes quick check tests run more cases; Updated build phases; Full test coverage; * Adds quickcheck tests as well as HPC coverage.

0.3.3 Luis Rodrigues Soares Mar 3 2015 Fixed upper bounds and lower bounds in dependencies; Fixed all HLint suggestions; Added HLint to the build; Fixed all -Wall errors on test phase; * Fixed all -Wall errors on compilation.

0.3.0 Luis Rodrigues Soares Feb 24 2015 Made -Wall default compilation option Added source-repository field to cabal file.

0.2.2 Luis Rodrigues Soares Feb 23 2015 Added a unit test; Removed warnings from cabal file; Updated references to dependencies; Fixed errors all over the place; Removed unused functions; cleaned up indentation.

0.1.0 Luis Rodrigues Soares Feb 21 2015 Added description to package; Fixed module references; Cabalized the project; Initial copy of Problem07.hs, from

Depends on 1 package:
Used by 1 package:
comments powered byDisqus