Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elm or PureScript (Replacement for JavaScript) ? #64

Closed
9 tasks
nelsonic opened this issue Oct 5, 2018 · 2 comments
Closed
9 tasks

Elm or PureScript (Replacement for JavaScript) ? #64

nelsonic opened this issue Oct 5, 2018 · 2 comments
Assignees
Labels
discuss Share your constructive thoughts on how to make progress with this issue help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies

Comments

@nelsonic
Copy link
Member

nelsonic commented Oct 5, 2018

We have been using Elm for most of our Client & Internal Projects for the past 2 years; it's awesome!
Sadly, much of the [Client] work is closed source [client's decision, not ours] 😞
so we only have a handful of re-usable examples/packages published: https://github.com/dwyl?q=elm

PureScript has only been used on one [Client] project so far, but has been very fruitful.
The people in the team who have the most experience of PureScript are @roryc89, @Conorc1000 and @finnhodgkin who have written several thousand lines of production .purs ... 🎉
Luckily these gents have also written tons of Elm so they are uniquely positioned to compare the two languages/ecosystems and share their insights with the wider community.

What I would love to know (and, judging from the popularity of the question on HN, I'm sure many other people would be keenly interested) is:

Given your experience of both Elm and PureScript (i.e. knowing what you know now):

  1. If you were writing a Frontend-only App ["from scratch"]
    that relies on many Browser/DOM APIs, which language would you chose?

Specifically we are writing a "bare bones" tool that will track ("analytics" and "user action") events in Web Apps, the resulting compiled JS needs to be bulletproof, ultra-low-overhead (memory), lightning-quick (load and run on mobile browsers) and easy to maintain. The expected lifetime of the code is at least 5 years so we need to invest up-front to chose the most effective language/tooling/framework. We expect a "core team" of 1-4 people to write 95% of the code with a few Open Source contributions gradually trickling in; so we can afford to use a "less popular" language if it's worth the time/learning investment.

  1. If you were to start a brand new Backend or "Full Stack" project "from scratch"
    would you use Elixir + Elm or PureScript?

Note on "Other Options"

We are open to considering a "third" option e.g. asm.js, idris or nim
Our "selection criteria" is (as stated above, but bullet pointed here):

  • Compile-to-JS (ideally only "The Good Parts" and the earlier the JS target, the better, e.g: ES3 for maximum browser compatibility, we litterally need our Frontend app to "run everywhere")
  • Static Typing (Type-safety)
  • Purely Functional (ideal)
  • Good Garbage Collection (ideal. the lower the memory footprint, the better!)
  • Debugger/Debug-ability (essential)
  • Friendly Error Messages (mega bonus)
  • Ecosystem (bonus)

Relevant Background Reading

@nelsonic nelsonic added help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue discuss Share your constructive thoughts on how to make progress with this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies labels Oct 5, 2018
@finnhodgkin
Copy link

For front-end only development I definitely still recommend elm.

There are a few major reasons for this:

  • The Elm api is a lot smaller so there's less of an on-boarding cost for new developers.
  • Purescript provides a language with lots of freedom and no black-box features. Elm on the other hand is focused purely on it's core target: building error-free, maintainable web applications. Less choice in architecture/frameworks/modules is sometimes a really good thing for productivity.
  • Dev experience. Compile times can be quite large in Purescript. For front-end work I find this way more frustrating than back-end (where the majority of our Purescript is). It's not a dealbreaker but I really like to see UI updates instantly. Trying to match designs when there's any kind of a delay in class name changes, etc, is a real pain. There are probably ways to achieve similar speeds with Purescript but Elm gives you those features out of the box with no configuration.

There was a recent elm uprade (.19) that came with a set of features that on the surface I thought were a little disappointing, but I'm now a couple of weeks into using it and I was so wrong! The developer experience has been massively streamlined and it's an absolute joy to work with, especially on large projects.

I would pick Purescript if my project:

  • Had a really complicated API that changed frequently - Elm decoders can be a pain to write and keep up to date.
  • Had a large Purescript back-end. It's much easier to match types if the language is shared between the browser and the server.
  • Involved a lot of components or browser features that have already been 'solved' by the wider javascript or React community. The Purescript foreign function interface is a lot more concise and use-able than ports are in Elm - after a bit of setup you can just use javascript functions in Purescript.
  • Had an existing javascript codebase. Purescript can be used for parts or the whole, whereas elm takes a take-it-or-leave-it approach.

@finnhodgkin finnhodgkin removed their assignment Oct 5, 2018
@nelsonic
Copy link
Member Author

Closing as no longer relevant.
GOTO: #87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Share your constructive thoughts on how to make progress with this issue help wanted If you can help make progress with this issue, please comment! question A question needs to be answered before progress can be made on this issue technical A technical issue that requires understanding of the code, infrastructure or dependencies
Projects
None yet
Development

No branches or pull requests

4 participants