Sieve of Eratosthenes in Haskell I've implemented the Sieve of Eratosthenes algorithm in Haskell. Please take a look. Any suggestions are greatly appreciated :)

import Data.List

-- a list identical with {seq} but for multiples of {p} which are replaced by {-1}
sieve_once :: [Integer] -&gt; Integer -&gt; [Integer]
sieve_once seq p = map (\x -&gt; if x `mod` p == 0 then -1 else x) seq

-- a list of all prime numbers
sieve :: [Integer]
sieve = unfoldr (\acc -&gt; let p:rest = dropWhile (\x -&gt; x == -1) acc in Just(p, sieve_once rest p)) [2..]

-- a list of all prime numbers not greater than {n}
sieve_until :: Integer -&gt; [Integer]
sieve_until n = takeWhile (\x -&gt; x &lt;= n) sieve
I'd suggest to filter out unneeded elements, instead of replacing them by -1. Keeping and processing all the -1 is unnecessary:

sieve_once :: [Integer] -&gt; Integer -&gt; [Integer]
sieve_once seq p = filter (\x -&gt; x `mod` p /= 0) seq

-- a list of all prime numbers
sieve :: [Integer]
sieve = unfoldr (\(p:rest) -&gt; Just (p, sieve_once rest p)) [2..]