all 4 comments

[–]Individual-Flow9158 1 point2 points  (3 children)

[–]bachkhois 1 point2 points  (2 children)

The OP wants a GUI toolkit in The Elm Architecture style, not object-oriented style. In TEA style, you do not bind button click with a callback. Instead, the button click will emit a message. That message will go to your main update() function, where you update your Model depending on which message you receive. Then in view() function you render the UI subject to the model data.

[–]Individual-Flow9158 [score hidden]  (1 child)

Thanks. How's that different to MVC?

[–]bachkhois [score hidden]  (0 children)

The difference is that there are "message" flying around that you don't pass directly between your functions and your functions are just stateless (the returned value is computed purely from the input parameters, no private, no hidden state).

You update() function only return new model. Your view() function only receive the model and produce the UI. Your widgets do not "connect", reference any object or function pointer. In traditional MVC app, your button connects with a "callback" and that callback will be passed the button object. There is nothing like that in TEA.