News for hackers. Stuff that matters.
Re:Asset minification with Elm (2018) by pictur on Tuesday August 27, 2019 @11:57AM (#20811057)
Has anyone started a project with elm and continued it for a long time?
Re:Asset minification with Elm (2018) by Chadtech_Real on Tuesday August 27, 2019 @03:20PM (#20813466)
I have been writing Elm for 5 years now. I work at Humio, where our front end is 100k lines of Elm code.

What would you like to know? I love Elm. I'm absolutely hooked. I don't want to go back to doing Frontend work in JS, and I hope one day there can be an Elm-like experience for backend development as well.

Just off the top of my head a few bits of what I like about Elm: - You can actually write code, have no errors, and then move on, and never return to the project again. When I was doing JS, everyone I knew just took it for granted that you would be maintaining everything you ever wrote for the rest of your career. Not with Elm! You can actually finish projects and never return to them. - Its a simple and small language that is designed to interact with human beings. The compiler really talks to you instead of spitting out error codes or spaghetti. Apis and variables have human readable names instead of mathy terms of symbols. - For everything theres one way of doing things and the one way is usually really good. This strong consensus orientation of the Elm community means everyone is speaking the same language about every problem.

Gotta go, bye.

Re:Asset minification with Elm (2018) by no_wizard on Tuesday August 27, 2019 @06:18PM (#20815006)
I'm curious if you tried out ReasonML[0] at all, for any length of time, before Elm, or even after.

https://reasonml.github.io/docs/en/what-and-why

I've really been digging slowly into ReasonML and the biggest gain I can see is that valid reason === valid ocaml (and there's some good server libraries out there for ocaml)

I also like that JSX is the templating language, not that it matters.

Also, have you had any success with manipulating Elm to output static HTML/CSS as well as JS? I know it can do it, but I've never been able to manipulate how it does it (most recent version I tried with: 0.18)

Re:Asset minification with Elm (2018) by Chadtech_Real on Tuesday August 27, 2019 @06:29PM (#20815088)
I havent actually written any ReasonML, but I once had to review some my former coworker wrote. Thats the extent of my ReasonML experience, so I dont have much of an opinion. However, I was surprised that the ReasonML code I looked at relied on impure functions. I like pure functions so that scares me off a bit from the OCaml as a whole.

Regarding static html/css, I havent done that either, so I dont know about it.

Re:Asset minification with Elm (2018) by yawaramin on Wednesday August 28, 2019 @12:14AM (#20816729)
> the ReasonML code I looked at relied on impure functions. I like pure functions so that scares me off a bit from the OCaml as a whole.

ReasonML (OCaml) allows impure functions but the best practice is to stay pure whenever possible. It's a very pragmatic language so despite providing all the functional and immutable programming features, it allows you to cut through the bureaucracy if you need to.

Re:Asset minification with Elm (2018) by SupremumLimit on Tuesday August 27, 2019 @07:44PM (#20815510)
One way to get static HTML/CSS from Elm is to execute the JS it produces and serialise the results from the DOM. That's what I do in my static site generator Elmstatic: https://korban.net/elm/elmstatic
Re:Asset minification with Elm (2018) by excursionist on Tuesday August 27, 2019 @03:50PM (#20813765)
> I hope one day there can be an Elm-like experience for backend development as well.

Haskell?

Re:Asset minification with Elm (2018) by Chadtech_Real on Tuesday August 27, 2019 @04:33PM (#20814153)
They are pretty different. They have similar syntax, and their type systems are similarly strong, but beyond that they are pretty different.

Haskell has a huge syntax and a ton of language features. It has a big ecosystem. Haskell is very mathy. Elm is the opposite in each of those regards.

Re:Asset minification with Elm (2018) by ronanyeah on Tuesday August 27, 2019 @04:01PM (#20813873)
Unfortunately there is a large gap between the developer experience of both ecosystems.
Re:Asset minification with Elm (2018) by owl57 on Tuesday August 27, 2019 @04:17PM (#20814005)
> You can actually finish projects and never return to them

How do you manage that? Migrating from 0.18 to 0.19 wasn't hard in my limited experience, but it wasn't "finish and never return" either.

Re:Asset minification with Elm (2018) by Chadtech_Real on Tuesday August 27, 2019 @04:28PM (#20814109)
I dont even think upgrading to 0.19. If you have 0.18 code that works, why upgrade? I think NoRedInk has some very old versions of Elm still in production, like 0.16 or something.
Re:Asset minification with Elm (2018) by rtfeldman on Tuesday August 27, 2019 @06:39PM (#20815165)
Years ago we had some 0.18 and 0.16 code coexisting, but last year we updated everything to 0.19!
Re:Asset minification with Elm (2018) by ilumanty on Tuesday August 27, 2019 @05:58PM (#20814849)
How is your experience with more "advanced" stateful interactions such as drag&drop?
Re:Asset minification with Elm (2018) by Chadtech_Real on Tuesday August 27, 2019 @06:21PM (#20815025)
Good. I have written drag and drop functionality in Elm a few times. I have a clear enough idea on how that code looks that if I had to write a drag and drop today, I think I could crank it out quickly.

You call it stateful tho. I dont know that drag and drop needs to be all that stateful. For drag and drop, the information your model needs is whether you have mouse-down-ed on something, the coordinates on the html element you mouse-down-ed, and the coordinates the mouse's current location is. 2 pairs of coordinates and a maybe type? Not too bad. I guess there is the code too, but at least the data is just few values, and not a complex and nested data structure.

On my team at work, we avoid state. Complex nested state is a big code smell for us.

Re:Asset minification with Elm (2018) by Bastes on Tuesday August 27, 2019 @06:15PM (#20814979)
Been suggesting we use it for a complicated bit of interface for a company I was working at two years ago, we were pleasantly surprised at how well it held both in requiring low (almost no) maintenance once written and how easy it was to improve on the codebase.

We migrated pretty easily from 0.18 to 0.19, we only had to import a bit of code here and there from libs that would not migrate or update where changes had been made, strong typing and the compiler made it a rather pleasant experience.

The only thing we did not do was migrate to an SPA ; the scope of the app was wide and the cost to achieve this was too high I guess.

Few pain points, amongst which:

- Sometimes you have to do something you would expect to find off-the-shelf (like a souped-up drop-down or a tag editing system) but it's ususally a matter of designing your ui well and can be fun (plus you get to really design the user experience).

- Sometimes you have to do a bit of JS for stuff that aren't designed in Elm (anymore, ie websockets) and use ports to communicate.

- If you're building incrementally, and make mistakes (over-design, useless code to conform to an unrequired philosophy, etc.) it's a good thing to sometimes challenge the bad old choices and get them smoothed down ; thankfully the compiler is your friend here too.

- The learning curve, especially if your team isn't fond of functional programming, can be daunting if you don't have an Elm advocate. That was me in my team, and we grew fond of it, but made quite a few beginners mistakes on the way. All very fixable though.

Well, that's about it ; if you want help getting people started and boosted on the functional programming paradigm, please have a look at my blog: it's Elm-centric, focusing on the most important functional programming concepts that'll get you up and running on what's happening there :) https://medium.com/wat-the-elm-ist And it might even explain what monads are ;)

Re:Asset minification with Elm (2018) by augustin82 on Tuesday August 27, 2019 @04:18PM (#20814021)
We've been using it in production since the end of 2015. We have two main products whose front-end is written entirely in Elm, a third one in development, totalling about 80k loc.

It's a blast, it's a wonderful developer experience, it's changed my life as a developer after having to fight with Angular and React and the myriad of tools you need to use to have a decent experience.

It would be difficult for me to consider a position where I would not use Elm anymore, and if I did it would have to satiate my thirst for functional programming by letting me work with other cool similar languages.

Re:Asset minification with Elm (2018) by absynce on Tuesday August 27, 2019 @03:40PM (#20813665)
I've worked on two (2) substantial production Elm applications.

1. Healthcare

Fall 2017, I started integrating Elm into an AngularJS application after experimenting with it on a couple of side projects. After a successful initial feature, I convinced the team to use it for new features. Another couple of developers helped to create the initial version until late 2018. We started in Elm 0.18 and converted it to 0.19. Now a sole part-time college student maintains and adds new features to it.

2. Transportation management

Since January 2019, I work on an Elm project, once again weaved into an existing AngularJS app, with ~34k lines of Elm code. I inherited it with no interaction from the previous developer. It looks like it was introduced in mid-2017 and is currently on Elm 0.19. Although it is not perfect, not always following best practices, it is much easier to maintain than anything I've worked on in the past. On JS apps, I've torn my hair out trying to figure out what is going on and attempting to add new features.

With Elm, I refactor daringly and rest more easily.

Please let me know if you have any specific questions.

Re:Asset minification with Elm (2018) by Scarbutt on Tuesday August 27, 2019 @05:58PM (#20814853)
Since January 2019, I work on an Elm project, once again weaved into an existing AngularJS app, with ~34k lines of Elm code.

Watching a simple example in the elm website, the codes make judicious use of new lines, would you say those 34k lines would represent 17K in js?

Re:Asset minification with Elm (2018) by jxxcarlson on Tuesday August 27, 2019 @11:51PM (#20816636)
Yes, something like that. Almost everyone who writes Elm code uses elm-format which is very "spacey". So foo = 1 is formatted with foo = on one line and 1 on the next, with some leading space.
Re:Asset minification with Elm (2018) by seddona on Tuesday August 27, 2019 @12:42PM (#20811662)
Yep we build CircuitHub (YC startup) on Elm. I know quite a few companies that also have large Elm code bases.
Re:Asset minification with Elm (2018) by BozeWolf on Tuesday August 27, 2019 @02:45PM (#20813131)
The “example” is crashing my safari on iphone xs. Impressive product though.

https://circuithub.com/projects/ti/TIDA-00230

Re:Asset minification with Elm (2018) by seddona on Tuesday August 27, 2019 @07:39PM (#20815492)
Thanks for the bug report, I'll let the dev team know!

I wouldn't consider that a problem with Elm it's just that our users are mostly on desktop Chrome so we don't test very often on mobile Safari.

Re:Asset minification with Elm (2018) by BokuBeam on Tuesday August 27, 2019 @02:37PM (#20813041)
We've used it pretty heavily at Drip for nearly two years now. It's been great for taking on some complex UI and making it maintainable.
Re:Asset minification with Elm (2018) by jxxcarlson on Wednesday August 28, 2019 @12:09AM (#20816708)
I wrote a library that parses a subset of LaTeX and renders it as HTML. See https://demo.minilatex.app/ or more at https://minilatex.io I was astonished by what is possible to do with Elm. This is a continuing project. It is easy to go back to the code even after leaving it untouched for several months. I've engaged in "extreme refactoring" many times. No fears!

I've also written a bunch of small mathy apps, e.g. https://jxxcarlson.io/apps/

Elm has been a joy to work with.

Re:Asset minification with Elm (2018) by icidasset on Tuesday August 27, 2019 @02:46PM (#20813137)
If you're interested in an open-source project, I've been using Elm in https://github.com/icidasset/diffuse for 2 and half years now.
Re:Asset minification with Elm (2018) by neillyons on Sunday September 08, 2019 @06:55PM (#20913905)
Looks great!
Re:Asset minification with Elm (2018) by philh on Wednesday August 28, 2019 @11:06AM (#20820501)
We've been using it for almost two years. I wrote this just after the 0.19 release and still stand by it; I wouldn't start a project in Elm again until I'd explored more options (in particular purescript).

https://www.reddit.com/r/programming/comments/992qe5/elm_019...

Re:Asset minification with Elm (2018) by mjaniczek on Tuesday August 27, 2019 @04:43PM (#20814241)
Yeah, our work frontends are done in Elm, my side-project SaaS is done in Elm, etc. The maintainability is fantastic. Do you have more specific questions / concerns?
Re:Asset minification with Elm (2018) by Scarbutt on Tuesday August 27, 2019 @06:28PM (#20815087)
Is ELM a good fit for non-SPAs web apps?
Re:Asset minification with Elm (2018) by jweir on Tuesday August 27, 2019 @07:20PM (#20815381)
We have been using for about 3 years now. Myself and the two other devs enjoy working in it more than the other languages we use (Ruby, Go and vanilla JS).

Upgrades have been pretty painless, and each new release brings a new level of ease of use.

We have made some architectural mistakes as we have learned the language. And since it is a newer language there are not as many established conventions for code organization – but we are figuring out.

Re:Asset minification with Elm (2018) by mordrax on Wednesday August 28, 2019 @08:21AM (#20819030)
I've had a hobby game in Elm which I worked on for about a year and a half and I was the second engineer ( frontend lead ) hired to 'rescue' a greenfield project with Elm as the frontend. That is now at 100k+ LOC, 2.5 years later. Our team has grown from 3 to 9, we have 3 frontend devs all writing in Elm and looking for our 4th.

The company now has 4 production projects with Elm as the sole frontend tech.

Re:Asset minification with Elm (2018) by pyrale on Tuesday August 27, 2019 @01:31PM (#20812318)
We have elm running in prod for about 2 years in my team, and our story has motivated a couple more teams to use it.

Do you have specific questions ?

Re:Asset minification with Elm (2018) by raxor53 on Tuesday August 27, 2019 @01:25PM (#20812236)
I know NoRedInk has a lot of Elm components; however, they employ Evan Czaplicki, who is the creator of the language.
Re:Asset minification with Elm (2018) by danpalmer on Tuesday August 27, 2019 @01:37PM (#20812387)
It’s worth noting that they first used Elm very extensively, then because of that they hired Evan to maintain the language there.
Re:Asset minification with Elm (2018) by danabrams on Wednesday August 28, 2019 @10:29AM (#20820119)
I've used Elm for frontend pretty much exclusively since 2016. In the last two months I changed jobs and now write a bunch of typescript, and it's fine, but would much prefer to be writing elm...I mean, I'm only working on backend right now, but still...
Re:Asset minification with Elm (2018) by dorian-graph on Thursday August 29, 2019 @11:40AM (#20830470)
I'm curious about why you prefer Elm over TypeScript, as both are statically typed
Re:Asset minification with Elm (2018) by ronanyeah on Tuesday August 27, 2019 @04:07PM (#20813925)
Been using Elm exclusively for 2 years. Many projects of different sizes. Very pleased with it.
Re:Asset minification with Elm (2018) by auslegung on Tuesday August 27, 2019 @04:04PM (#20813901)
ITPro.TV is using Elm to build all their new dynamic frontends, and is refactoring their legacy app using Elm.
Re:Asset minification with Elm (2018) by cc-cpo on Wednesday August 28, 2019 @01:30AM (#20817037)
How about cross mobile apps (ionic/cordova)?
Re:Asset minification with Elm (2018) by akoppela on Wednesday August 28, 2019 @01:52AM (#20817158)
I developed mobile app on Elm with Cordova. Works great. Will be published to store soon.