Hacker News new | ask | show | jobs
by Torn 4359 days ago
Also typing in their code example (the one right at the top, pride of place) into their 'Try it' repl throws an error:

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

    <hint>:1:8: parse error on input `='" error

Now I have almost no knowledge of Haskell, so I'm probably making some really basic mistake, but I figure most visitors will try that and then get put off
1 comments

Yes, that's certainly an issue. In fact the "Try it" box also seems to work differently from the standard haskell live interpreter, in which you'd be able to define functions by prefixing them with 'let '.

If you still want to try it out, say

    let sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p /= 0] in sieve[2..]