by christiansakai · 5y ago · 0 comments
Besides, as far as I know, the PureScript part is only for the business logic, not for the rendering, etc like if you want to use React or Angular or pure DOM manipulation. The backend story goes the same (i.e, PureScript only for business logic).
With the extra tooling required (i.e, spago, bower) it seems pretty pointless to use PureScript these days, what am I missing? Someone please convince me to use PureScript.
You want PureScript because you want the safety of Haskell style functional programming on the frontend, with strict types, effects tracking, category theory, and all.
You want Scala.js because neither of these extremes are appealing to you. You've been burned by Typescript, you're interested in functional programming but don't want to completely give up the good parts of OOP just yet (or ever).
I'm here to sell Scala.js (of course). You can use it with React or with one of Scala.js UI libraries. It's very nice.
https://github.com/com-lihaoyi
Of all these languages I find Scala the "biggest" language: most syntax to learn, most quirks, least notion of what is idiomatic.
I'm not here to sell Scala, more warning people to stay away from it.
The language, like any other, does have some quirks, but Scala 3 takes care of many long standing problems (in RC1 already).
It's true that there is no single idiom for Scala code. That's because unlike other languages, it's a true multiparadigm language, and so different people actually do use it differently. It's not a monoculture, but there is a well defined idiom for each style, be it hardcore FP, or Actor based programming, or Java++, or something in between.
Anyway. Ocaml is one of the better alternatives, but it's not without its problems either, both in terms of language and ecosystem.
You only need to use one of spago or bower (spago being the recommended choice now), and that's because npm style dependencies are not suitable for PS.
As for why you'd choose it over TypeScript... well, you'd do so if you want to use a functional language that doesn't allow arbitrary effects and has a sound type system.
If you're adding all the complexity that comes with using a language that must first be compiled to ECMAScript anyway, then why would you pick a language that's essentially ECMAScript with fancier clothes?
The build chain complexity tax is already paid. Now you can go for the best language the ecosystem offers. Half-measures seem wasteful.
(This was at least how I reasoned when I went for F#-to-ES.)
I would be very very cautious about this line of reasoning. It can work for certain situations, but there are enough tradeoffs and exceptions that I am hesitant to recommend this as a general rule of thumb.
The ability to incrementalize risk (JS code snippets on the web just work, the compilation target is trivial to deduce, runtime characteristics do not change, no need to write wrapper code to consume npm packages, etc) instead of taking a lump sum hit to your novelty budget is valuable. Not always overwhelmingly so, but enough to give me pause.
Few plusses
- It handles dom manipulation. - Simpler syntax - Elm-UI framework - No extra dependencies
Fair. And that's what it wants/advertises to be. "Not a general prog lang".
> Its approach also doesn't scale. Too much writing, like Redux.
Not sure what you mean by this. Software that needs to scale do not run in browsers. Elm is just for the FE bit, the UI, the interactive browser stuff. Hence the DSL thing makes sense (to me); though I totally understand one does not like that.
And when it comes to writing: it has very terse syntax. Look at all TodoMVC examples and you find that Elm will use about the least number of characters of any implementation that gives strong typing guarantees.