When comparing GHCJS vs Vue.js, the Slant community recommends GHCJS for most people. In the question“What are the best solutions to "The JavaScript Problem"?” GHCJS is ranked 8th while Vue.js is ranked 23rd. The most important reason people chose GHCJS is:
With a Haskell backend, GHCJS enables code sharing. In combination with the power of Haskell as a language, this enables an extremely tight integration of the client side with the server side, where all the communications take place in a type-safe manner and even transparently if desired.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Full Stack Code Sharing
With a Haskell backend, GHCJS enables code sharing. In combination with the power of Haskell as a language, this enables an extremely tight integration of the client side with the server side, where all the communications take place in a type-safe manner and even transparently if desired.
Pro All of Haskell, with the same tools you're used to
No need to learn new syntax or semantics, and no need to install and learn a bunch of new tools - it's just GHC.
Pro Mature language and community
Pro Terse
Haskell is a very terse language, particularly due to its type inference. This means there's nothing to distract from the intent of the code, making it very readable. This is in sharp contrast to languages like Java, where skimming code requires learning which details can be ignored. Haskell's terseness also lends itself to very clear inline examples in textbooks, and makes it a pleasure to read through code even on a cellphone screen.
Pro Quick Feedback
It's often said that, in Haskell, if it compiles, it works. This short feedback loop can speed up learning process, by making it clear exactly when and where mistakes are made.
Pro Can be used with any front-end stack
Vue can easily be integrated with other front-end libraries. This makes it an extremely versatile tool and it's easy to fix its shortcomings or missing features by just plugging in another library.
Pro Single file component
Very useful.
Pro Lightweight
Vue.js weighs in at 16kb min+gzip.
Pro Vuex store, events system
Pro Reactivity system
Pro CLI and Webpack integration
Pro Responsive server-side rendering
Since most of the mainstream server-side rendering implementations are synchronous, they can block the server's event loop when the application is complex.
Vue implements streaming server-side rendering, which allows you to render your component, get a readable stream and directly pipe that to the HTTP response. This allows you to have a responsive server and decreases the time your users have to wait before they get your rendered content.
Pro Supports inline templating
Although you can build components in JavaScript files, you can also use inline handlebars-like templating in your HTML views where simplicity is often a more sane choice.
Pro Can be made even lighter
Since the template-to-virtual-DOM and compiler can be separated, you can compile the templates in your machine and then deploying only the interpreter which is 12KB minified and gzipped.
Pro Support for both templates and JSX
You can choose to use either a templating language, or if you feel it's necessary to drop on a lower virtual-dom level, you can use JSX. This is simply done by replacing the template
option with a render
function.
Or alternatively, you can embed functions inside templates by using the <render>
tag.
Pro SEO friendly
Starting with Vue 2.0, Vue supports server-side rendering. This helps with SEO a lot, since the views are rendered directly on the server, which are indexed by search engines.
Pro VueRouter
Cons
Con Large runtime
GHCJS supports the entire Haskell runtime, the Javascript it outputs tends to be quite large. This is in contrast to options such as Fay, which save some overhead by not supporting some features such as multi-threading.
Con Poor typescript support
Very basic typescript support.