3 ms·
> Congratulations, you've reinvented objects. Objects are opaque handles to a state machine which contains an undefined state, that's not what Elm is. Elm is p
by runeks 9y ago
> Congratulations, you've reinvented objects.
Objects are opaque handles to a state machine which contains an undefined state, that's not what Elm is. Elm is pure, so you only define transformations, and compose them together. The runtime system keeps track of state, not you as the programmer. You just define transformations from one or more types to another one, compose them together to form descriptions of how to transform one, e.g., UI layout into another, connect it to user input, and everything is guaranteed to fit together (unless you ignore important warnings). You no longer keep track of state, you define functions that transform one piece of information into another, and define functions that render a static piece of information into a UI.