There are many lists of languages which compile to Javascript:
https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-jshttp://www.infoworld.com/article/2606392/javascript/156855-X-languages-that-compile-to-JavaScript.htmlhttp://smurfpandey.github.io/altjs/http://www.slant.co/topics/101/~languages-that-compile-to-javascriptAll those listed above seem to lack at least ad hoc polymorphism, except for the Haskell-to-Javascript variants (and perhaps the OCaml/ML-to-Javascript compilers although at least
row polymorphism is not ad hoc polymorphism).
I have been studying
PureScript, which is basically
a Haskell clone without the memoization, lazy evaluation, and co-inductive type hierarchy. PureScript retains the desired ad hoc polymorphism.
PureScript's main feature that differentiates it from
Haskell-to-Javascript compilers is that it is designed to compile to
human comprehensible Javascript, which is fairly easy to correlate with the PureScript source code.
My complaints:
1. No first-class unions (aka disjunctions) and intersections (aka conjunctions), which I had explained (at the linked post quoted below) are necessary so ad hoc polymorphism isn't somewhat crippled. The alternative of
Either enumerations are not first-class, thus aren't composable.
2. Pure functions are required everywhere, which those forces Haskells
Monadic and
Applicative side-effects abstractions, which are very non-intuitive for programmers coming from C, C++, Java, Javascript, PHP.
3. No
async/
await nor generators, and instead must use another of those Haskell higher-order monadic abstractions, the
Continuation monad.
4. No unsigned integer (i.e.
i >>> 0 in Javascript), and no sized integer types such as i32, u32, u8, etc..
5. Build system requires Node.js.
Other aspects I admire:
1. Tail recursion
is optimized to a
while loop.
2. Functions
are curried by default, with a comprehensible
representation in Javacscript.
3. Ad hoc polymorphism
dictionaries are input in a curried function.