Issue 16

Issue 16

One needs a master's degree in CS to understand and write effective regular expressions. It's quite easy to create an invalid regex too, and Elm compiler will not help here. If that happens, how your code should behave? Jeroen Engels, the guy behind Elm Review has written a long and detailed article about the safe-unsafe pattern, and explains how to deal with inherently unsafe functions (and why elm-review can help you write better code).

Ryan Frazier is continuing his epic series on writing a calculator in Elm. The latest article is on keyboard input events. If you keep seeing the following placeholder code every now and then:

subscriptions : Model -> Sub Msg
subscriptions _ =
    Sub.none

and keep wondering what are subscriptions, then this article is for you.

Ever needed to create animation of a sushi plate moving on a conveyor? Sure thing, I need that almost daily. Well, jokes aside, this is a nice intro into CSS transforms and how to do that with Elm, written by Luca Mugnaini.

Discussions

There are still discussions happening on the topic that Luke has raised in his monumental posts. Here's another reason why someone might feel unhappy about the language and the infrastructure around it. I still think that like in a healthy relationship, one needs to discuss problems openly without being afraid of repercussions. And the result should be a better and healthier community. If there are people who are disappointed by this technology, then the goals and processes weren't as clearly communicated, the decisions weren't as transparent. There is also a more technical discussion on a similar topic. It's a bit sad to see community fragmenting.

An interesting discussion on using shared state between the pages. How can you make sure that user is logged in on all protected pages? If you're up to relying on a bigger "framework", then Elm SPA solves that with global model. For smaller projects there are a lot of useful suggestions in the comments.

Projects

Mario Rogic did a presentation at the last year's Elm Europe titled Elm As A Service. Here's a video if you're curious:

Elm As A Service

For the past 3 years he's been busy building Lamdera (announcement on discourse), a type-safe full-stack web-app platform for Elm. What does it mean? Hosting, deployments, migrations, networking, encoders/decoders, and persistent storage are handled by Lamdera, so you can focus on your application logic, not glue code.

The project is still in alpha, but you can already ask for an invite if you have an idea for a project. It is free during the testing period.

One of the foundations of the platform is called Evergreen, a type-safe migration system that allows to deploy new app versions and live-reload all connected clients while also preserving the state. This is quite interesting because how to do you tell users to refresh the page when the new version is out? And if they do refresh it, do you lose all of the state? Or do you save it all into the local storage? Finally, if your new app has changes in the state schema, how do you deal with those?

I have a similar problem at work and the way I solved it (or rather just kicked the can until it becomes a bigger problem) is by providing the full schema with meaningful defaults that the app can then populate without crashing. A naïve approach that works for me now while the codebase is still small and the number of people working on it is just a handful of people, but Marco has come up with a more interesting an elegant way: migrations. Think of them as something similar to Ecto Migration in Phoenix. You describe what has changed and how to transform from one type to another. Very neat. For some of the behind the scenes take a look at his talk from 2018:

Evergreen Elm

Alex Korban has created a page with examples of Elm-UI in action. Want to get a snippet with styled button? Or a chat layout? Head over here.

There is another option for writing css in Elm: using rtfeldman/elm-css  Ricardo García Vega has built elmcsspatterns.io which showcases various layouts and components that can be built.

Let me finish this one with a quote from Naval Ravikant:

Lockdown is rehab for society to break its addiction to unnecessary commuting for unnecessary meetings.
Show Comments