haskell-infra / www.haskell.org

www.haskell.org site source
http://haskell.org
BSD 3-Clause "New" or "Revised" License
107 stars 95 forks source link

Haskell prompt at the webpage won't receive all Haskell expressions #162

Open alexdesiqueira opened 2 years ago

alexdesiqueira commented 2 years ago

Hey everyone, while checking the webpage, I saw the Haskell prompt: image ... it said Type Haskell expressions in here. Then I gladly typed the example code on the top of the webpage,

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

... and I got an error message :slightly_smiling_face:

<hint>:3:8: parse error on input ‘=’

Firstly I thought, did I do something wrong? :slightly_smiling_face: I think this prompt is prepared to receive a small set of operations, for the tutorial, is that right? If that's the case, maybe it could be helpful to write the message Type Haskell expressions in here in a slightly different way. What about Type here Haskell expressions presented on the right., or something like that. Maybe that's too pedantic, and please feel free to close the issue if you don't think it's relevant, but I think it could help someone else careless enough — like myself :wink: — when they make the same mistake in the future. Thank you!

TikhonJelvis commented 2 years ago

The prompt on the website has a real Haskell interpreter that should be able to do more than a preselected set of examples. However, it's mostly for interpreting expressions with limited support for definitions. I'm not 100% sure what those limitations are, but I expect it's similar to or even more restricted than GHCi.

Trying out the example the way you did makes sense though. Seems like we could rewrite the example to use let instead of where—a bit less idiomatic, but would work as an expression :)

ulysses4ever commented 2 years ago

@TikhonJelvis why don't it understand the usual :{ ... :} notation available to GHCi? Is it not backed by GHCi? It seems sad that the very primes example shown prominently on the homepage is impossible to put into this REPL (it seems); without rewriting it with let that is.

@alexdesiqueira I'd say if you want a more complete Haskell experience online, you may want to look into https://replit.com/

TikhonJelvis commented 2 years ago

Right, it's not backed by GHCi, it's an interface over tryhaskell.com which I understand to be implemented on top of hint. If you're curious, the source for tryhaskell.com is available online.

alexdesiqueira commented 2 years ago

@alexdesiqueira I'd say if you want a more complete Haskell experience online, you may want to look into https://replit.com/

@ulysses4ever I just opened the issue to point a cognitive dissonance I perceived while checking the site :joy: Thanks for the input, though! Please feel free to close the issue if it's only bothering y'all.

ulysses4ever commented 2 years ago

@alexdesiqueira I'm sorry if my advice sounded unhelpful or dismissive, I certainly didn't mean it. I hoped it can help you to achieve your goals. If you wanted to only provide some feedback on the website, that's perfectly fine, and I really appreciate your input and totally agree with it.

I hope that the Haskell community (including but not limited to the haskell.org board) will figure a better way to showcase the REPL. Even the primes example, which is featured on the main page so prominently, seems impossible to get in the REPL on the same page. This is very sad.

alexdesiqueira commented 2 years ago

@alexdesiqueira I'm sorry if my advice sounded unhelpful or dismissive, I certainly didn't mean it. I hoped it can help you to achieve your goals. If you wanted to only provide some feedback on the website, that's perfectly fine, and I really appreciate your input and totally agree with it.

@ulysses4ever oh no, don't worry at all! That wasn't the impression I had. I understood your objective there, and I thank you for your input—I didn't use replit before, and it will be useful for sure :slightly_smiling_face: I just realized due to the conversation that it's not something "easier" to deal with—it can't be helped, at least not easily :joy: