r/purescript • • Jul 17 '25

Is it worth learning PureScript? So far the experience was less than ideal.

I am not a Java or SQL programmer, but I was able to quickly get up and going. The error messages made sense. The documentation had plenty of excellent examples.

Here you get confusing type errors. Some examples on the web appear to be broken on purpose, so they are useless. Type signatures are not examples. There is very little traffic on the discourse. Copilot gives nonsense answers and even contradicts itself.

So, I am asking, is there a light at the end of the tunnel? How did you get over the inability to write a simple variant of a simple project?

Was it worth to persist and why?

9 Upvotes

32 comments sorted by

View all comments

Show parent comment

1

u/Exact_Ordinary_9887 Jul 17 '25

Your ChatGpt forgot to remind me to run:

spago install maybe

spago install web-html

spago install web-dom

After this I reduced error to

Error found:
in module Main
at src/Main.purs:10:17 - 10:30 (line 10, column 17 - line 10, column 30)

  Cannot import value querySelector from module Web.DOM
  It either does not exist or the module does not export it.

1

u/GetContented Jul 17 '25

I almost asked if you knew you had to install libraries. :) Glad you figured that out. Thanks for sharing the error!

So check in Web.DOM's API that querySelector is there, then. That's straightfoward isn't it? I'm assuming you know pursuit if you've read the book you mentioned. Or at least the basics of that book, or if you've read the intro to purescript.

To do this, go into pursuit, then search for querySelector, then look for the one that matches the right capitalisation, then notice that it's moved into a different sub module. Change it and save/recompile.

I would be careful expecting everything to be easy if you don't learn the basics. It's absolutely not. It'll burn you and you won't want to continue. Please don't do that! This is one of the most joyous FE programming experiences there is, so long as you upgrade your understanding to a certain level. It can certainly be frustrating at times because there are a few weird edges, but learning the basics pretty much solves most of them.

0

u/Exact_Ordinary_9887 Jul 17 '25

Pursuit which query selector I should use? there are 10 if I am not mistaken.

I need DOM related, but which one?

Can you see how your advice is missing the target?

1

u/GetContented Jul 17 '25

I think perhaps you might have missed some of my suggestion.

As I said... check in Web.DOM's API that querySelector is there.

If you search in pursuit for querySelector, yes you'll find 10, but if you then look at where they are in the results and see ones that are within that module, as I said. You'll find there's only one in Web.DOM. It's been moved to a sub module called Web.DOM.ParentNode by the looks of things. That's still within Web.DOM.

1

u/ruby_object Jul 17 '25

https://github.com/bigos/Pyrulis/blob/3cd62b640b392db711c2bf375b7e84aaa38c9d97/Purescript/parameters-and-configuration/second-attempt/src/Main.purs#L37

We have lift off!

to make matters worse, the answer was here:

https://book.purescript.org/chapter8.html

Why did nobody point me to the right page and fragment?

I spent 4 days on that!

1

u/ruby_object Jul 18 '25

But in the end I had success.

1

u/ruby_object Jul 22 '25

Trying to figure out how to have a working HTTP POST request took me days. Maybe I have proven I can pick up the basics at a very slow pace. However, I would like to know where I can have a better experience. The beginner level examples are lacking.

While I eventually found the cookbook, adapting the example took way too long.

0

u/Exact_Ordinary_9887 Jul 17 '25

1

u/GetContented Jul 17 '25

Why are you looking in Halogen?

1

u/GetContented Jul 17 '25

Yeah that's using the library I'm suggesting you use. You can use that if you like.