learn-elm icon indicating copy to clipboard operation
learn-elm copied to clipboard

Elm vs TypeScript?

Open nelsonic opened this issue 8 years ago • 8 comments

asked by @stevepeak in chat ... elm-vs-typescript

relevant to @Kumjami, @jruts & @Talento90 who are all .ts aficionados. 😉

nelsonic avatar Nov 15 '16 16:11 nelsonic

@Unfortunately I have never tried Elm so I can't compare them :(

I found this topic that can be useful for this discussion.

Talento90 avatar Nov 15 '16 17:11 Talento90

@Talento90 thanks very much for sharing that link! ❤️ hopefully once our learn-elm is #ready we will be in a position to make a fair comparison. 😉

nelsonic avatar Nov 15 '16 17:11 nelsonic

From my point of view, TS is just a super set of ES6, we could call it ESX or whatever. It is cool because it should be easy to learn if you already know ES6, and you can be sure your code will be more robust than with just ES6.

The cool thing about Elm is that is a pure functional language. It is a good way to learn more about that paradigm, and also your code will be more robust (more than if you were using TS!) because it is also typed, but it also handle undefined and null with the Maybe type, and that is awesome.

... another good point about TS is that it can also be used in the backend ...

gabrielperales avatar Jan 31 '17 10:01 gabrielperales

@gabrielperales agree, TS is a superset that allows JS people to add useful type annotations. 👍 We used TS on a couple of client projects and the team at the client loved it. The reason I prefer using Elm is because it's a much smaller language This page of how to define variables is one of the many reasons why I prefer Elm: https://www.typescriptlang.org/docs/handbook/variable-declarations.html

I 😍 the fact that Elm has let but no var or const and that all variables are immutable by default without needing to import another library like immutable.js or mori.

Elm's advantages are not limited to Type annotations, immutability and reduced (but still complete) language feature.

Perhaps the best description of "Why Elm" is the "6 Months With Elm talk: https://youtu.be/R2FtMbb-nLs?t=47m36s

nelsonic avatar Jan 31 '17 13:01 nelsonic

As I said before I have never tried elm but how about ScalaJs? It is functional and typed language! It seems to be a third option!

Talento90 avatar Jan 31 '17 18:01 Talento90

Elm vs. PureScript is probably a bit more 🍎 's to 🍎 's

Both are heavily influenced by the Haskell language, from where we get a lot of the principles we often cite when talking about Elm..

  • Lazy evaluation
  • Pure functions
  • Fast, immutable data structures
  • Type declaration

On that note, there are some complaints that Elm doesn't support custom types.

Purescript is definitely gaining some traction. There are a few videos on Egghead.io and I know that Christopher Allen (@bitemyapp), author of Haskell Book seems to be a fan, (judging by his repos).

newswim avatar Jan 31 '17 18:01 newswim

@newswim I use GHCJS at work, not PureScript.

Please don't invoke my name in favor of languages just because I forked some repositories.

bitemyapp avatar Jan 31 '17 18:01 bitemyapp

@bitemyapp My apologies, I didn't mean to speak for you, my hope was just to document this space more thoroughly. I thought I saw a video where you were speaking of it positively, but then couldn't find it. My mistake, again.

newswim avatar Jan 31 '17 19:01 newswim