concept controller in category f#

This is an excerpt from Manning's book F# Deep Dives.
The controller is the chief component of MVC because it contains most, if not all, of the presentation logic. Its essential responsibility is to execute event-specific computations while reading and updating the model state in process. The simplest variation of the controller is the event-handling function of type ('TModel -> 'TEvents -> unit), as you saw earlier.
Most screens in GUI applications aren’t empty when first opened—they display information immediately. This means the view model needs to be initialized. Suppress your initial instinct, inherited from the good old OOP days, to put the model initialization logic in the model’s constructor. This practice forces the model to have dependencies on external resources such as database connections and web services, and eventually testability will suffer. Placing this code in the controller’s InitModel and employing the principle of dependency inversion helps. Ideally, the model is a purely declarative data structure and contains no logic. This is a typical separation for a functional paradigm. To encourage external initialization, a parameter-less constructor constraint exists on model implementation.
The data-binding transformations introduced earlier are a handy feature. They allow you to run mapping computations every time the property changes. But this can be limiting. What if you need to execute a computation in response to a change in a set of properties? So far, you’ve had to keep those inside the controller. A specific example is the PNL calculation. Somewhere in the controller is the following code:
model.PnL <- let x = decimal model.PositionSize *? ( model.Price ?-? model.Open) x.GetValueOrDefault()The PNL calculation depends on three other properties of the model: position size, current price, and open price. If any of these values change, PNL has to be recalculated. Because these changes can be caused by different events, the calculation needs to be handled in more than one place in the controller’s code. This quickly becomes a daunting task and can lead to duplication and errors.