9 ms·
A nice app on Elm street
- fortran77 7y agoI love Elm, but this tutorial is based on Elm 0.18, and 0.19 is out. There are some straighforwared but significant changes with how an application is set up. If you're just starting out, find a 0.19 tutorial.
- a-saleh 7y agoT.b.h. this is the reason why I will probably stay messing around with either PureScript or ReasonML but stay away from Elm.
- k_bx 7y agoWhy exactly? Elm 0.19 is out on August 2018, and the only thing that's expected is 0.19.1 which barely changes anything (doesn't break any api). Seems like 0.19 is quite settled at this point.
- sacado2 7y agoWill my Elm code written today still be maintainable with an up-to-date elm environment in 3 years? It certainly isn't the case with code written 3 years ago.
- fortran77 7y agoI agree this is a problem, but what "JavaScript" compiler/language technology isn't changing rapidly? 3 years ago we were using JQuery.
- jweir 7y agoDoubtful, but possible. What is highly likely is there will be 1 or 2 upgrades between now and in 3 years. If history is any indicator these upgrades will be relatively painless. The next upgrade, 0.19.1, will be completely backwards compatible.
- hellofunk 7y agoBy contrast, I have a 12K-line Clojurescript project from 6 years ago that interfaces with React and still compiles and runs beautifully, even if I update the Clojure language version to the current version.
- a-saleh 7y agoOk, I should have said 'one of the reasons' ... and maybe there is a better road-map, but I was dabbling with Elm around 0.16, and then watched 0.17 change a bunch of stuff I liked to bunch of stuff I didn't care about as much and I decided to stay away for a while. But if it looks like we would be on 0.19.x for few years to come, I might dip in it again ... it's not like I ever published anything in Purescript or ReasonML and I never used Elm in anger, so it is probably just a matter of time til I jump in again :)
- k_bx 7y agoYes, frustration of people going through previous versions is definitely a thing! Let's recall not only the infamous drop of JS FFI (for Ports), but also things like ditching custom operators. Let's see how >0.19 will go.
- deleted 7y ago[deleted]
- crusso 7y agoYeah, I balked at changing my apps to be 0.19 compatible. Now I'm kind of just "getting along" with 0.18 until I can do more of my front end work in Phoenix LiveView.
- zellyn 7y agoI've been lurking Elm for a while, and with Elm 18 came to the conclusion that I should avoid it, because there was a single creator who simply could not keep up, and was uninterested in fostering a healthy community of contributors. With Elm 19, I changed my mind. A closer following of the community shows that Evan is (a) nice, and (b) interested in contributions, but mostly in a researchy way. More importantly, Elm 19 seemed (to me) to tip the balance in usefulness and cleanliness. And with the idea of taking Elm straight to WASM (and with WASI around), things are looking interesting in the (eventual… gosh but it moves slowly) future. tl;dr: It's absolutely worth taking a new look at Elm 19.
- jweir 7y agoIn my experience this has not been a problem. First upgrades are very infrequent. Second, they occur for very good reasons. Third there is tooling to handle a lot of the code migration. Fourthly, the compiler will help you fix the rest. Lastly, each new version has been a real improvement on the previous.
- jamil7 7y agoI think the title should be edited. There is no section that combines Elm with React, it's mostly used for comparison.
- andreascreten 7y agoYou are right! I updated the title.
- yakshaving_jgt 7y ago> But you will still hit regular road-blocks which learning it because of how alien some of its paradigms are when coming from Javascript. I always found this to be a weird take. Elm is "Maybe Not As Good" because the average JavaScript developer isn't immediately familiar with it? Maybe we should just be less averse to learning new things, and I don't think simple syntax swaps really count as new things. Unrelated: your ToC doesn't work.
- Anahkiasen 7y agoI didn't mean that only Javascript developers would be lost, more that Elm kind of "does its own thing" and as such some of its errors or mechanics can be a bit cryptic and require some more experience with the language. It's not a language you can pick up and go as easily as Javascript is more what I meant, in my opinion at least unless, you're already familiar with pure and strictly typed languages.
- yakshaving_jgt 7y agoI don't think Elm does its own thing. The ideas used in Elm are more "discovered" than "invented" (at least relative to JavaScript), if you're familiar with that line of thinking. I also don't think its errors are cryptic. Elm's error messages are best in class. > It's not a language you can pick up and go as easily as Javascript I don't agree with this either. After having taught people Elm, and also JavaScript as a first language, I don't think mutability is more intuitive to a beginner.
- yannickdepauw 7y agoThanks for pointing out, will look at the ToC asap.
- k__ 7y agoHow does Elm compare to ReasonReact?
- Anahkiasen 7y agoOooh that's a very hard question :p I'd need to sit down a bit to answer it, to be honest it could almost be its own article. They both try to accomplish the same things through very different means with very different backings (Facebook versus literally one person). I can already tell you that ReasonML definitely has my preference these days over Elm, for the simple fact that I can keep using React with it. I love React, it's one of my favorite frameworks. If you're already familiar with it you're 50% of the way there to learn ReasonReact, whereas with Elm it really lives in its own little universe that you need to get familiar with from scratch. I find ReasonReact's underbelly a bit messier, and the compiler is not as good nor as clear as Elm's though. And the whole OCaml layer brings some chaos too, like the multiple standard libraries available in ReasonML (OCaml's, ReasonML's, etc) which can all be very confusing when you begin. So, I wouldn't really know what to tell you, it depends wildly of your experience, what you like, what you're looking for in the language and so on. I'd definitely recommend to give both a shot and see what you like as they're both great languages to me, even if ReasonML has my preference.
- purple_ducks 7y ago> the compiler is not as good nor as clear as Elm's though in the article, you mentioned: > the compiler is one of the best compilers I’ve ever seen and will not compile if it detects that your code is not sound. It seems like your're judging the entirety of the compiler just on it's user displayed error messages?
- Anahkiasen 7y agoIndeed sorry that's badly worded, both compilers are very good, I meant more the UX around compilation in general as I'm not apt to judge the compilers themselves.
- Rotareti 7y ago
- Cayuelas 7y agoxfth
- Cayuelas 7y agoreste
- thepratt 7y agoFor anyone new trying to get into Elm (as a language/tool), I would look elsewhere. ReasonML, PureScript, TypeScipt, etc are all better featured solutions. Having said that, the article is well written and thorough for anyone wanting to take a look into Elm. But there are massive problems with Elm itself which make it impossible to consider seriously. I have and still do use Elm in production, and went through the nightmare upgrade from 0.18 to 0.19. 1. Elm ports are not sound. Elm will tell you everything is good but doesn't do simple checks - as say PureScript does - to see if your port code actually exists or adheres to the defined contract. There are other tree-shaking issues, but Elm does not know and does not care about the js you've written. 2. Evan holds the naive view that everything can be rewritten in pure Elm and there's no reason not to. An overwhelmingly common use-case is 3rd party services or tracking libraries where it's impossible to re-implement; these apparently don't exist. 3. Elm applications, without a Redux-style (domain-specific to Translator) pattern, end up being horrendous spaghetti code of everything knowing about everything. Cmds and Tasks are a pain to work with when they should be interoperable in some manner. For small embeddable or personal projects Elm is a fun tool. I don't see it being more than that until more community involvement is permitted - removing the dictatorship.
- fortran77 7y agoElm has solved big problems with us, and for everything that can run in the "pure Elm" side of things, we have very few problems.
- nilkn 7y agoFor what it's worth, PureScript is much more complex than Elm. I see people recommend it, but I don't see people actually use it nearly as much as Elm (not that Elm is super widely used, of course). I do agree that the biggest thing Elm needs is to open up development, break down the "dictatorship" as you put it, and accelerate the pace rapidly.
- wtetzner 7y agoI think OCaml/ReasonML seems like the nicest choice, even if you're using the Elm architecture. Functors make it really easy to combine components, which actually makes it nicer than Elm for the same tasks.
- CountVonGuetzli 7y agoFirst time in a long time I actually enjoyed using front-end tech. Elm sparks joy, similar to Ruby/Rails did back in the day <3.
- kryptiskt 7y agoAre mere users still not allowed to interface with JS from Elm? I lost all interest when that came down.
- neoberg 7y agoI don't think there will ever be a way to interface js directly from elm or vise versa. Ports are the only way.
- jlengrand 7y agoHa, OP meant directly? Well AFAIK that is simply not possible, to keep the purity of Elm programs. All has to go through the Elm architecture. Or am I mistaken?
- neoberg 7y agoSorry for the late answer but yes it's not possible to keep elm's purity and safety while having a direct interface to js.
- jlengrand 7y agoYou mean ports and flags? It's described right in the tutorial : https://guide.elm-lang.org/interop/ports.html https://guide.elm-lang.org/interop/ports.html. I wouldn't call it not possible. It is necessary to have the cool stuff of Elm, unfortunately (or not). It's not rocket science tough, and it allows for clean interfaces. I wrote about it just a couple ago ago : https://lengrand.fr/a-short-introduction-to-ports-and-flags-in-elm/ https://lengrand.fr/a-short-introduction-to-ports-and-flags-...
- masklinn 7y agoJS interop has never been an issue, it's publishing JS-interop packages which is gated[0]: port module is available in applications but not packages. [0] formerly behind a review queue / review process to add to native-whitelist, now limited to two specific "core" organisations
- seddona 7y ago
- jlengrand 7y agoI am a back-end developer, and I don't know front-end. I also know very little of functional programming. Elm is the only language that I like writing, and where I don't feel in a state of frustration when I write. It might have a lot of limitations, bu tit makes me happy. Given that our job is basically to be in a constant state of half broken code, this makes me a huge fan of the language.
- al2o3cr 7y agoour job is basically to be in a constant state of half broken code In my experience, Elm code is only ever in a state of "horribly broken, won't compile" or "works". Whether that's a bug or a feature depends on what I'm trying to do...
- Touche 7y agoThat's interesting. How does Elm statically know if the logic of your app is correct? Since I don't know Elm I'll use some pseudocode: if condition pourCoffee() else pourTea() Is Elm able to determine that this condition is flipped the wrong way?
- jlengrand 7y agoYes, because in elm everything is pure. At least in the code you write. Elm will force you to declare all possible cases that can happen, all branches in every function you write. That leaves literally nothing to break. Not saying you can't break an elm program. But you won't run into runtime exceptions in elm, by design:)
- jweir 7y agoElm makes no claims to correct your logic. Logical errors are not caught by the compiler. You might still decode a JSON field to the wrong field on a Record (if the fields are the same type), you might invert a BOOL and use True were you meant False, you might incorrectly calculate some value, etc. But, state errors are caught – your application can not get into an impossible state and therefore should never have any runtime errors. Getting back to logical errors – Elm can provide some additional safeguards. For example you could have a record ``` type alias Point = { x: Int, y: Int } ``` and then decode it with ``` decode.map2 Point (field "y" int) (field "x" int) ``` Whoops you got the wrong order. So you could make X and Y explicit types: ``` type alias Point = { x: PointX, y: PointY } type PointX = PointX Int type PointY = PointY Int decode.map2 Point (field "x" decodeX) (field "y" decodeY) ``` Now your decoder won't compile unless the types line up correctly. But this adds a bit of extra overhead in unwrapping the values, but not much.
- CatrionaJasica 7y agoit’s a very valid choice when looking for Elm alternatives that have more backing at the moment
- m000 7y agoThis is the only Elm I know: https://en.wikipedia.org/wiki/Elm_(email_client) https://en.wikipedia.org/wiki/Elm_(email_client)
- KurtMueller 7y agoEvery post on Hacker News regarding Elm the language inevitably includes this post about Elm the email client.
- m000 7y agoTBH this is the first time I've heard about Elm, the language. I was wondering why nobody else had made the joke, so I took a stab at it.
- gdotdesign 7y agoI'm curious if you know about the language I created - Mint (https://www.mint-lang.com https://www.mint-lang.com)? And if you do what is your impression? I created it because I was frustrated with Elm (more the community than the language itself although the language has some issues as well).
- fistOfKross 7y agoBeen working with Elm quite a lot. Every other web framework I've stumpled upon in my career appear like utter crap compared to this beauty.
- antouank 7y agoBeen working with Elm on so many projects the last 2-3 years. I don't think any other js-based framework can reach the benefits that Elm brings. Correct, readable and sane code at scale. And, like others said, makes front-end coding enjoyable and confident. JS is a scripting language, good for small and quick scripts. Shouldn't be used for anything more than a few hundred LOC.
- deleted 7y ago[deleted]
- hackerbabz 7y agoIf I have time off to learn a new language in order to get a new Job, would Elm be a good choice? I wonder if picking a niche language would give me an advantage or there would be too few jobs.
- sacado2 7y agoThe biggest problem with elm in production right now is that there is no backward compatibility yet (version < 1.0). Code written in Elm 0.18 is not compatible with code written in Elm 0.19.
- myth_drannon 7y agoToo few opportunities, learn Typescript.
- sacado2 7y agoI like Elm as a language, but the community is extremely toxic, and it's not production-ready yet (version < 1.0, one-person project). Too bad, because it's a great project.
- iamwil 7y agoHow is it toxic? All the comms I've read from Evan were pretty polite.
- crtlaltdel 7y agocan you site some sources for the “extremely toxic” community? genuinely curious
- zinclozenge 7y agorichard feldman, evan's colleague, is not exactly a nice person on the internet. There are several times where he's ranted or had a temper tantrum for no particularly good reason. now he alone does not make up the "community", but he's certainly a prominent member of it.
- sacado2 7y agoI've seen people banned from official forums because they disagreed with design decisions. And several threads locked with messages like "oh yeah, haha, we don't really want you to talk about that" (https://discourse.elm-lang.org/t/elm-0-19-released-what-has-changed-regarding-native-event-modules/1670 https://discourse.elm-lang.org/t/elm-0-19-released-what-has-... for instance) And the github forum rules are a little "threatening" (https://github.com/elm/forum-rules/blob/master/README.md https://github.com/elm/forum-rules/blob/master/README.md).
- whateveracct 7y ago> not production ready (version < 1.0, one-person project) This is FUD. Elm is being used pretty successfully in production.
- sacado2 7y ago
- jxxcarlson 7y agoMy own two cents worth on Elm. I've worked with many languages, beginning with Fortran in my student days that I had to punch my own cards, then doing Basic, Pascal, C, C++, Python, Ruby, Javascript, Lisp, Scheme, some Haskell, not necessarily in that order. I've never had more fun and felt more productive than with Elm. The ability to do "extreme refactoring" and come out on the other side with everything working is liberating, exhilarating, and makes code maintainable and growable over the long term. Been using it now for three years.