A small dive into, and rejection of, Elm
Anders Hovmöller
7516

Wow, a harsh title for a post. ;)

Sometimes the easy things take a bit more effort in Elm, but you are rewarded with having PERFECT CODE that never breaks. It’s hard to really wrap your head around what that means. The reason to use Elm is so you can sleep better at night, knowing that any code that compiles is going to work. Forever. Even if you hire a junior coder and let them refactor everything. If they get it to compile, it will still work! Amazing!

Yes, that means there are trade-offs, and you stumbled upon one of them. When you interact with the outside world, e.g. a web browser, you need to make sure that the data you get back is what you think it is. That’s why Elm never crashes. It forces you to check.

Also, if you’ve never done functional programming, it takes a while to wrap your head around it. Once you have, it’s hard to go back.

Anyway, check out a solution to your problem. I think this does what you’d want. Or what I’d want, anyway!

PS you wouldn’t use a Union Type, as cool as they are!

Reactive ‘select’ in Elm:

https://runelm.io/c/7me

Show your support

Clapping shows how much you appreciated Adam Forbes’s story.