$_ doesn't get localized to the codeblock in this call to map; assign to a local var first.
Sieve of Eratosthenes in Haskell:
sieve :: [Int] -> [Int] -> [Int]
-- sieve [] xs
-- Assuming that xs is a list of the form [2..max], returns a list of
-- primes between 2 and max. The first parameter is an accumulator
-- list.
--
-- This is a loose interpretation of the Sieve of Eratosthenes; instea
+d
-- of marking composite numbers, we remove them.
sieve p [] = reverse p
sieve p (x:xs) = sieve (x:p) (filter (\t -> (rem t x /= 0)) xs)