When comparing F# (via FunScript) vs Haskell (via GHCJS), the Slant community recommends Haskell (via GHCJS) for most people. In the question“What are the best languages that compile to JavaScript? ” Haskell (via GHCJS) is ranked 28th while F# (via FunScript) is ranked 36th. The most important reason people chose Haskell (via GHCJS) is:
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.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Easier transition from other paradigms
Since F# is not a purely functional language, it lends itself to being more easily picked up by programmers that have experience with other paradigms.
Pro Concise syntax
F#'s syntax tends to be terse while remaining very readable and easy to understand without being a chore to write.
Pro Runs on the CLR
Since F# runs on the Common Language Runtime or CLR, it has access to the entire .NET Framework, as well as libraries written in other .NET languages such as C#, VB.NET, and C++/CLI.
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 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 Provides seamless concurrency, without the need for promises or callbacks
Pro Built-in REPL which lets you interact with your GHCJS compiled web page
Cons
Con Not really cross platform
Though the community sites are touting F# can be cross platform through use of Mono, the reality is that it is more of a hack to replay on larger mono applications in production.
Con The generated code can be difficult to debug
It should be mentioned that since the execution model of Haskell is very different from common imperative languages (lazy evaluation), the generated code doesn't resemble the source code at all, so it can be very difficult to debug.
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.
