|Portability||Non-portable (GHC extensions)|
|Maintainer||Daniel Fischer <firstname.lastname@example.org>|
Prime generation using a priority queue for the composites.
The algorithm is basically the one described in
it uses a more efficient heap for the priority queue and a
larger wheel, thus it is faster (in particular, the speed
is much smaller) and uses less memory.
It is nevertheless very slow compared to a bit sieve.
This module is mainly intended for comparison and verification.
A list of primes. The sieve does not handle overflow, hence for
bounded types, garbage occurs near
. If primes that
large are requested, use
instead. Checking for overflow would be slower. The sieve is specialised
, since these are the most commonly
used. For the fixed-width
Word types, sieving at one of the
specialised types and converting is faster.
To ensure sharing of the list of primes, bind it to a monomorphic variable,
to make sure that it is not shared, use