marionette is a small PureScript only MVC library.
- Module documentation is published on Pursuit.
spago install marionette
marionette is agnostic of how the "Control" part and the "View" part is handled. Thus for each
marionette program you have to chose a "controller" (1) and a "renderer" (2).
This packages includes a couple of controllers:
PureControllerA simplistic controller that is completely pure and does not perform any side effects.
ControlAPIControl handler that runs in
Affand provides a beginner friendly API to handle state updates with effects.
MonadicThe most flexible way to handle state control via a
Renderers are very environment specific and are defined in other packages:
With those options at hand you can for instance run the same state machine as CLI and in the browser. The renderer packages contain complete examples.
Q: Does it have "components" with local state?
A: No, there's only one global state. (Comparable to Elm)
Q: How are side effects handled in state updates?
A: If you chose the "monadic" or the "controlAPI" controller you can perform side effects mixed with asynchronous state updates in the control function. (Comparable to Halogen event handlers)
Q: How about subscriptions for recurring effects?
A: For now there's no special subscription mechanism implemented. However, besides state updates you can also trigger new messages from within asynchronous control handlers. As the examples show, with this you can implement subscriptions manually.
Q: If many control handlers can run asynchronously and can even trigger new ones recursively. How about memory leaks?
A: For the time the state machine is running you have to take care about this manually. However, all running control handlers are canceled automatically once the state machine exits.