I'm looking into functional languages that can transpile to JS. Should I learn Elm or Purescript?
I have a bit of prior Haskell experience, just enough to know what a monad transformer is.
For what purpose? With its first-class closures, partial application, and natively-implemented {map, filter, reduce} JS is already functional as heck. Justimport * as _ from 'underscore'if you want stuff like zip and repeat.
Read this:
http://mutanatum.com/posts/2017-01-12-Browser-FP-Head-to-Head.html
Perhaps vanilla JS with Ramda and Mocha might be enough for you.
For a more general FP experience ScalaJS might be a good choice.
Since you already have haskell experience, this means purescript is going to be accessible to you. I believe it is more difficult to get started with purescript than elm, but elm is going to be more limiting in the long run.
Elm is going to be easier to get things done like rails but you are constrained to the elm framework. Elm is more popular and you may find jobs for it.
>>61716982
The purpose would be for the haskell style type system. I didn't really appreciate it until I did some significant work in purescript and saw what a difference it made for refactoring.
It moves a lot of bugs/user errors from runtime issues into compiler errors/warnings.
Use Haskell, Stack can make a HS->JS compiler for you.("stack new ghcjs")
>>61716982
>>61717424
You don't transcompile to Javascript for language features, you do it so you don't have to use Javascript.
>>61717392
>but elm is going to be more limiting in the long run.
I've read this elsewhere, but isn't only a frontend replacement for js? What are the limits then?
>>61720804
Elm includes the "elm architecture" which is the builtin, conventional API for doing webapps. It includes things like Models, Messages, and HTTP requests. I haven't used it very much but it is something like the framework Redux.
This framework is basically what Elm is all about, so it is not really used as a language outside of that. I also heard that the language creator doesn't want it to be used for server side code (node.js).
Purescript does not have this problem as it is firstly intended as a general purpose language. Frontend frameworks are separate libraries like Pux or Halogen. The trade-off is that it slower to get started as there is no "official" way to do things. The community, documentation, and error messages of Elm make it much easier to get up and running.
>>61717424
>It moves a lot of bugs/user errors from runtime issues into compiler errors/warnings.
Wow, if only other languages and frameworks that could do that. The first one to do it for the web was killed off starting 06 or so because jobs didn't like it. The second in 08 was Google's attempt and laughed away by your average web idiot because web just doesn't adhere itself to compiled languages. Then we had a period of rebuilding things that had been around since 03, leading us to today with incredibly innovative, cutting edge things like typing systems (typescript), web workers (threads), angular/react (flash), and web assembly (compiled binaries).
Nope, a functional lisp clone within an already bloated world of toolchains and reengineering is the clear solution to this problem.