Haskell for Perl ProgrammersInfinite ListsPrimes (with low efficiency)

3.2. Primes (with low efficiency)

primes
= sieve [
2
..]
where
    sieve (x
:xs)
= x
:(sieve [a
| a
<- xs, a
`mod` x
/=
0 ])

Written by Shlomi Fish