Absolute beginner with some silly questions

Hi all,

I am not entirely sure if purescript could be a nice fit for a very specific use case.
I know nothing about the language, but my decision to learn it heavily depends on if I can use it for that use case.

I have a Django project, the classical MVC monolith, I am using Javascript only when needed, one of the spots I use js is to render an image gallery.

Can I use purescript to do browser development and maybe manipulate the DOM?

Thank you

2 Likes

Yes to both - compiling to JS that runs in a browser is one (the?) main use of the language and you can basically do everything you could with javascript (there is a nice FFI even if you don’t find a package) - manipulating the DOM is more or less simple (as simple as it is in JS) even if you don’t use a UI framework.

But if this is a good fit for you probably depends on more: Do you like typed, pure functional languages? Is learning this just for a small part of your program worth it? Maybe TypeScript is a better fit?

In the end only you can answer those but if you want to try we can surely help you translate what you have into PureScript so you can see if you like it.

3 Likes

Yes to both - compiling to JS that runs in a browser is one (the?) main use of the language and you can basically do everything you could with javascript (there is a nice FFI even if you don’t find a package) - manipulating the DOM is more or less simple (as simple as it is in JS) even if you don’t use a UI framework.

Thank you, sounds excellent.

But if this is a good fit for you probably depends on more: Do you like typed, pure functional languages? Is learning this just for a small part of your program worth it? Maybe TypeScript is a better fit?

I use Erlang and Elixir at work, I am loving functional languages.
I am not sure about typings TBH, I guess I’ll discover it.

Thank you!
I’ll give purescript a spin for sure.

2 Likes

Feel free to ask if you struggle somewhere - always nice to get new people on board :wink:

1 Like

As @CarstenKoenig said, yes to both. The majority of PureScript use is via UI libraries like React and Halogen, and I think it shines there; it’s also possible to do manual DOM operations, but that code tends to be fairly imperative and you may find that PureScript isn’t much advantage over something like TypeScript.

3 Likes