When comparing Amber vs Fay, 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 Amber is ranked 27th. 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 Includes an IDE
Amber includes an integrated development environment with a class browser, workspace, transcript, object inspector and debugger.
Pro Smalltalk is a simple, elegant, and powerful language
Pro One-to-one JS equivalent
Amber is written in itself, including the parser and compiler, and compiles into efficient JavaScript, mapping one-to-one with the JS equivalent.
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.
Cons
Con Very few learning resources
There are very little learning resources for Amber outside the official documentation. Which may not be enough for beginners, especially people that don't have much experience in programming.
Con No typeclasses
This can cause some overhead.