When comparing ClojureScript vs PureScript, the Slant community recommends PureScript for most people. In the question“What are the best languages that compile to JavaScript? ” PureScript is ranked 5th while ClojureScript is ranked 6th. The most important reason people chose PureScript is:
Has Typeclasses and RankNTypes
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Live interactive programming with figwheel
Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding! Every time you save your ClojureScript source file, the changes are sent to the browser so that you can see the effects of modifying your code in real time.
Pro Simple syntax
Lispness makes ClojureScript trivial to comprehend after an initial learning overhead.
Pro Easy to use existing JavaScript libraries
Clojure and ClojureScript are designed to be able to interact with their host. So the language by design makes it is easy to use existing JS libraries.
Pro Targets Google Closure-ready JavaScript for immense optimizations
Google's Closure Library converts regular JavaScript into a highly optimized form - including dead code analysis/elimination. It can even remove pieces of unused code from 3rd party libraries (eg, if you import jQuery but only use one function, Google Closure includes only that piece).
Pro Share application logic between browser and Clojure server
Clojure is also able to run web servers, so one can reap similar benefits to NodeJS in terms of sharing code between client and server.
Pro Can be used with React out of the box
Pro Excellent build tools
Both Leiningen and Boot are great build tools that manage code dependencies and deployment.
Pro Excellent tools for web development
ClojureScript has superb wrappers around React.js (see Reagent) that make building single-page apps a breeze. With figwheel, it's a web dev experience unlike any other -- hotloaded code, repl interaction, and instantly reflected changes make good development fun and fast. You can add things like Garden to make CSS-writing part of the same holistic experience and suddenly all development is a pleasant, smooth process.
Pro The Spec core library
From the creator of Clojure:
Spec is a new core library (Clojure 1.9 and Clojurescript) to support data and function specifications in Clojure.
Writing a spec should enable automatic: Validation, Error reporting, Destructuring, Instrumentation, Test-data generation and Generative test generation.
Pro Higher kinded types
Has Typeclasses and RankNTypes
Pro High performance FFI code
The Eff monad, which is used for FFI code, optimizes out calls to bind, and supports tail call optimization, resulting in clean, efficient Javascript. The psc compiler also specifically recognizes the ST monad, and transforms scoped variables into mutable Javascript variables, for even more efficient code.
Pro Type safety
Compiling should be your first unit test. A tight type system (static and hopefully strong) will catch many logic errors that are often difficult to spot through debugging. In languages like PureScript, if it compiles, it often runs properly.
Pro Pure functional language
You cannot have side effects, unless a function is explicitly defined as so.
Pro Modules can be compiled to CommonJS
Modules compiled to CommonJS can be included with 'require', making it incredibly simple to call Purescript code from Javascript.
Pro Has row polymorphism and extensible effects
Pro FFI
FFI system is quite good and easy to use. You can import functions curried or not curried. Records and arrays use native JS objects and arrays.
Pro Thorough documentation
The Purescript website has fairly thorough documentation for all of the language's features, and the Purescript blog contains several examples of practical usage.
Pro Awesome web frameworks
Thermite (React)
Halogen (VDOM, similar to ELM)
And hit these up with Signals, Isolated/(Managed?) Components, powerful functions and FFI
Cons
Con Tooling is horrible
I've never seen worse tooling before. Writing tests and getting test coverage reports is near impossible. Tooling is brittle and clunky. Feels prehistoric.
Con Syntax may seem cryptic to people not used to Lisp
Lisp is sometimes called "syntax-less" and this is bewildering to those steeped in Algol-type syntax (Java, Javascript, C, etc). Being a dialect of Lisp, ClojureScript's syntax may seem cryptic and hard to understand for people not used to it. While Lisp has very little syntax compared to other languages and it's generally considered pretty terse, there's still an initial overhead in learning the language.
Con Lots of dependencies needed to get started
Purescript is written in Haskell, but meant to be used with Node.js. As a result, to get started , users must install ghc, cabal, node.js, grunt, and bower. Purescript also has its own compiler, and different semantics form Haskell, and so even after installing, there's still some overhead to getting productive with Purescript.
Con Lack of good IDE/tooling support
Con Documentation not updated
Con Ecosystem not stable
Con Restrictive FFI
Functions exported are all curried, and must be called as such from Javascript. The FFI syntax for importing Javascript functions, while slightly simpler and more readable than UHC/Fay's, means that calls to methods on objects must be wrapped to pass the object explicitly as a parameter.
Con Slow compilation
On large project, for example Halogen