Hacker News new | ask | show | jobs
by tree_of_item 3176 days ago
> My second example is a gui. It feels to me like your program couldn't in any way define the interface layout. All it could do is 'receive' and 'issue' events. It would take a specialized compiler, and a whole separate mark-up language to actually define the interface. How do you change the interface in response to input?

As one example, the program might be written in model-view-controller style:

* Your "model" is a type `Model`.

* Your "view" is a function of type `Model -> Display`.

* Your "controller" is a function of type `(Model * Event) -> Model`.

The runtime is responsible for feeding your controller events to get a new model, then running your view on the new model to create a display, then actually rendering that display.