When comparing Fay vs Vue.js, the Slant community recommends Fay for most people. In the question“What are the best solutions to "The JavaScript Problem"?” Fay is ranked 11th while Vue.js is ranked 23rd. The most important reason people chose Fay is:
Fay produces smaller output than pure Haskell compilers such as GHCJS; It does not need to include the whole Haskell runtime, as it drops support for features such as multi-threading, giving it fewer dependencies.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Small output
Fay produces smaller output than pure Haskell compilers such as GHCJS; It does not need to include the whole Haskell runtime, as it drops support for features such as multi-threading, giving it fewer dependencies.
Pro Simple, flexible, hackable FFI
As with UHC, the FFI to Javascript works with printf-style format:
max = ffi "Math.round(%1,%2)"
This can simplify code needed to make calls to methods on objects, in contrast to e.g., Purescript's FFI, which requires that methods be wrapped in Javascript. Similarly to UHC, Fay also supports the use of %*
, for javascript functions with arbitrary numbers of parameters, such as concat
, though they must expose an explicit number of parameters to Fay.
Pro Easy to set up, with packages available on Cabal
Fay is available on Cabal, as are Fay packages, so getting up and running is as simple as typing 'cabal install'. Happstack, Snap, and Yesod packages are available on Hackage, as are bindings for JQuery and Backbone.
Pro Subset of Haskell - nothing new to learn
Since Fay is a subset of Haskell - Lazy, statically typed, and pure by default. There's no new syntax to learn, and no surprises when it comes to the semantics of your code. This extends into function names as well - Fay programmers can use familiar functions such as putStrLn
to output to the console, rather than Javascript-specific versions.
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 No typeclasses
This can cause some overhead.
Con Poor typescript support
Very basic typescript support.