1. 29

  2. 5

    I was a tad disappointed when I tried their example code in the REPL:

    λ primes = sieve [2..] 
    <hint>:1:8: parse error on input `='
    1. 4

      This is a good old definition/expression issue.

      A function definition in haskell (what you write in a file) is not an expression (what you write in a shell, or as right hand side of the = in a function definition). The closest possible thing is a let expression. It would be nice if they displayed that, but for whatever reason, they didn’t.

      So, to do what you want, just try type in let seive ... = ... then let primes = seive [2..], then you can type in primes 10 to call the function you defined. :)

      1. 3

        edit: I had deleted this because I completely misread lenary’s comment. but he beat me to it with a reply, so I better put it back for context :-)

        This is true, but I think OP was mostly saying that haskell.org should not put a sample block of code right above the REPL that doesn’t work in the REPL.

        1. 5

          I agree.

          Also, the thing with let doesn’t even work, so it’s not even a fully-fleged repl. Fucking hell.

          I think there’s still value to showing how code looks, ie the code you will commonly see (that which is in files), rather than what you might type in a repl.

          1. 1

            Yeah unfortunately it seems to be stateless, so you have to give it an expression.

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

            seems to work as intended :)

    2. 3

      Is there a reason for not using Haskell Platform as the download page anymore? I always used that on Windows.

      1. 11

        I think a lot of people moved away from the platform. The old versions of libraries caused problems. Mostly better to just use GHC and Cabal with sandboxes.

        1. 9

          I’ll rehash what I said on Reddit:

          I used to tell people in my guide to install Haskell Platform, but I stopped because it kept creating problems. Haskell Platform causes trouble for new people when the globally installed packages get old. These very same new people are the ones least equipped to cope with or understand the problem or where it comes from.

          Platform should be recommended when it is the best option available for the majority of Haskell users.

          Here’s what Anthony Cowley (an active, helpful contributor in the Haskell community) had to say:

          Yes, a regular frustration when helping folks on IRC is that the first three steps have so often been to,

          1. Apologize
          2. Instruct how to uninstall what they have
          3. Start again with GHC and cabal