double stream feed to prevent unneeded memoization?

Normally, definition of primes stream in Richard Bird’s formulation of the sieve of Eratosthenes is self-referential: import Data.List.Ordered (minus, union, unionAll) ps = 2 : minus [3..] — `:` is “cons” (foldr (\p r -> p*p : union [p*p+p, p*p+2*p..] r) [] ps) The primes ps produced by this definition are used as the input … Read more