Elm made me hate working with Javascript in my job, and the differente is brutal. I don't believe in silver bullet but this is the domain where Elm shines: frontend development. I love every aspect of it. Elm is a very simple language, generates very small assets with a really fast compiler, gives us guarantees of no runtime exceptions in production, easy refactoring (in JS it would be a nightmare), has a time travel…
Just out of curiosity, how often do you use time travel debugging? I have redux dev tools and can use it on any of my apps, but I've never felt that it was more useful than the step debugger. The first time I set it up I thought "huh, cool" and then never used it again. There's also the issue of side effects like ajax requests that interact with the outside world.
Ask HN: Anyone Using Elm in Production?
61–70 of 74 posts
Re: Ask HN: Anyone Using Elm in Production?
#62Would also be interesting to hear the reasoning of someone who has seriously considered using Elm but ended up with not using it.
The ecosystem offers some trivial packages, but the hard stuff is missing. JS interop is intentionally quite painful. I'd consider it sufficient for fairly trivial SPA use, but lacking for anything large or anything requiring browser APIs.
The language development is a big red flag: virtually all commits have been made by a single developer. There are no RFCs, and the future direction of the language is very unclear. Any discussions about potential improvements are immediately killed. Releases are infrequent, and may cause very significant breakage, depending on your application.
It's probably the best thing in the JS ecosystem in a long time and i really want it to succeed and to use it more, but the current state isn't that great. Maybe in a year or ten.
Re: Ask HN: Anyone Using Elm in Production?
#63Earlier quoted context omitted.
What about ajax requests though? What if you are debugging a component that sends a DELETE request?
It doesn't end up spamming requests the same way as in react, as there is no "componentDidMount" that can trigger side-effects. In elm it's just different states being rendered.
You can isolate your side effects somewhere, but they still have to respond to actions/events/messages so if your time traveler dispatches actions you'll end up making duplicate requests.
Re: Ask HN: Anyone Using Elm in Production?
#64Earlier quoted context omitted.
Just out of curiosity, how often do you use time travel debugging? I have redux dev tools and can use it on any of my apps, but I've never felt that it was more useful than the step debugger. The first time I set it up I thought "huh, cool" and then never used it again. There's also the issue of side effects like ajax requests that interact with the outside world.
Everytime. If anything goes wrong I just see the message (action in redux) and see the current state in that time, so I can understand what happened. In some cases it is more effecting than sending a log.
Re: Ask HN: Anyone Using Elm in Production?
#65Earlier quoted context omitted.
It doesn't end up spamming requests the same way as in react, as there is no "componentDidMount" that can trigger side-effects. In elm it's just different states being rendered.
Ah sorry, I didn't mean side effects in lifecycle methods, I meant DOM events like click, etc. If you click a button that deletes a resource on your API, there is no time traveling because the outside world doesn't time travel along with your debugger (unfortunately). :) You can isolate your side effects somewhere, but they still have to respond to actions/events/messages so if your time traveler dispatches actions y…
Re: Ask HN: Anyone Using Elm in Production?
#66Earlier quoted context omitted.
Adding to others, with disclaimer that I haven't built a large application yet so these are relative newbie comments: 1. An amazingly helpful compiler. The best I've come across for identifying problems, describing them in a meaningful way, and suggesting how to fix. 2. A wonderful synergy between language and architecture. Various others have copied Elm's model-view-update architecture (React, F# SAFE) but as they'r…
What about good IDE?
Re: Ask HN: Anyone Using Elm in Production?
#67The codebase is around 60k LOC for the front-end and we've settled on a few patterns that help with reusability and managing complexity.
- We have moved to a very flat architecture where most things are at the top level of the state tree
- We use web components to wrap up things that are a pain in Elm (like exit animations, fancy text editors, interop with various JS libraries)
- Our reusable components take Configs so that the components are not tied to one Msg type, different pages have to provide hookups for those messages but it allows us to reuse components on different pages pretty easily.
Refactoring with confidence is possible! I have worked on large React/Angular apps where it was nigh impossible to refactor something without breaking a bunch of others things (often without a way to know they are broken aside from a full regression test). Typescript has improved things quite a bit, but it can't give you the same guarantees as Elm can.
As for difficulties we've run into:
- The virtual dom diffing slows down as the number of nodes grows, for our live chat we can have thousands of people chatting at once and diffing between the previous/next set of nodes can easily exceed the time we have for the next frame. We've taken to reducing the scrollback available in chat, virtualizing the list is another option.
- The time-travelling debugger is cool to show off but has some limitations that make it less useful in practice. If the Msg is long it gets cut off and there's no way to see the whole thing. There's no way to exclude or filter messages, if you have timer running the message list quickly fills up and it is difficult to find the Msg you want.
- When we were on 0.18 compile times were a large source of frustration, we ended up using a forked version of the compiler to improve things a bit, I wrote about it here https://medium.com/@antewcode/faster-elm-builds-e0669580ee67.
- There is little published information on what is coming down the pipeline, timelines for bug fixes, features, etc
This final one hasn't been a big problem in practice, but the prohibition on effect managers and native code in the community leads to teams all over the place reimplementing the same thing (e.g. interfacing with LocalStorage). It has never been possible to publish code using ports or native code to Elm's package manager, which I think is a good thing, but 0.19 also removed the ability to compile them locally without forking the compiler. I think I am in a very small minority in the community that thinks that effect managers are not evil and can be used for good.
Re: Ask HN: Anyone Using Elm in Production?
#68Re: Ask HN: Anyone Using Elm in Production?
#69Re deeply nested components: we have components about 2-3 levels deep, and while it's a bit more code and boilerplate than having a flat model, it's been just fine. Don't worry about it.
Re: Ask HN: Anyone Using Elm in Production?
#70Would also be interesting to hear the reasoning of someone who has seriously considered using Elm but ended up with not using it.
It's a neat little language. The benefits are real when coming from JS, but not that special when you consider other languages. Basically everything said in favour of Elm is completely true, but it's not the whole story. The ecosystem offers some trivial packages, but the hard stuff is missing. JS interop is intentionally quite painful. I'd consider it sufficient for fairly trivial SPA use, but lacking for anything l…
The problem with having a bus factor of 1 is that no one sees it as a problem until it becomes one.