r/purescript • u/Exact_Ordinary_9887 • 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?
View all comments
Show parent comment
2
u/GetContented Jul 17 '25
Halogen isn't so basic. I tend to use React & Hooks bindings instead. But maybe you don't know React?
Purescript's aim is to be like Haskell but compile to idiomatic javascript. It doesn't have ports and flags. It compiles to "just javascript". It uses a foreign function interface to "talk to" javascript functions and the DOM.
If you want to emulate Elm then maybe something like elmish is what you'd prefer. There are others, I think. I've not used them tho https://pursuit.purescript.org/packages/purescript-elmish/0.13.0 as far as I can see they don't have Ports tho, so you'd still have to use the Web.DOM library, I think.
Here's some code I asked ChatGPT to generate me that console logs some data out of some element by class. If you look up the APIs docs you can see how they work. I'm sure this code is right because it's very basic, and looks like code I've written recently.
Note how in Purescript we have to deal with being in the Effect monad, which is something you just don't have to do in Elm. It's not as simple as Elm.