r/purescript • u/mindeavor • Jun 09 '17
Why PureScript?
Hi all, I am searching to fulfill my dream of finding a language/ecosystem for elegant, strongly-typed web development. What would you say to convince me to learn & use PureScript? What makes it unique? Why use it over other the alternatives, such as Haskell, ReasonML / OCaml, FSharp, and so on?
I thank you for your opinion in advanced.
8
u/gilmi Jun 09 '17
I wrote a comment on a different thread in the context of ReasonML and I'll just link to it.
tl;dr: PureScript is:
Pure
Strict
Reasonable
Not only for frontend work
Has awesome features (HKT, row polymorphism, typeclasses with fundeps, higher rank types, etc.)
Straightforward code generation and FFI, and no runtime
Decent ecosystem
Good tooling and editor support
Developed actively and openly and has a nice community around it
I think all of these are pretty important and don't think there are other langauges that has it all.
1
u/haterofallcats Jun 13 '17
Stupid question, but I really like how reasonml supports jsx. Does purescript support jsx? If not, are there any technical reasons for not supporting it?
2
u/nmdanny2 Jun 17 '17
You dont need JSX for PSX as PS's syntax is succint enough for expressing a UI.
1
u/gilmi Jun 13 '17
I'm not an expert, but JSX is as far as I can tell pretty much a React thing. It might make sense for Reason to support it since Reason and React are both developed by Facebook but IMO it does not make sense for PureScript to support it. A few reasons why:
PureScript has many UI solutions and not just react so it doesn't make sense
JSX and React might change and we'll be stuck with the question what to do now
Supporting JSX is both a fair amount of work and complicates the language by a fair amount
I'm sure there are more technical issues with it regarding to purity and such
14
u/tdammers Jun 09 '17
Because it's the alternative that sucks the least:
GHC Haskell: toolchain is painful to set up, underdocumented, and dependency management turns out rather brittle; using nix to solve this is a very large hammer. The runtime is rather totalitarian, that is, integrating ghcjs with existing JS codebases or frameworks is difficult.
OCaml: not pure
F#: not pure, and smells too much of .NET for my taste
Elm: feels like Haskell for dummies, the designerd seem to err on the side of catering for beginners, even if that means that positively useful features (typeclasses) won't make it into the language. The tooling is clearly meant to be helpful, but more often than not, the balance tips towards overly opinionated and condescending, especially when you know what you want but the tools don't agree or don't understand. Forward compatibility and reproducible builds have also been a problem for me in the past.
plain JS, ES6: not even typed
TypeScript: not pure, types are opt-in, type system isn't very strong
ClojureScript: not typed, not pure, and the recommended live-coding workflow seems dangerous and brittle to me (have been bitten by it more than once).