diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-09-06 10:23:11 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2022-02-07 16:22:43 +0100 |
commit | 155fec516022d2d5a1343312792dce21f466573a (patch) | |
tree | a01ec039fb78da8bcc696a439aca9245204d7e60 /lib | |
parent | ae94a13a2621d7c57584206ef73755f0fbb65a0a (diff) |
Update application description
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/application/application.ml | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/application/application.ml b/lib/application/application.ml index 63e12ba..789bd80 100755 --- a/lib/application/application.ml +++ b/lib/application/application.ml @@ -12,18 +12,34 @@ [ type state = { value : int } - (** Increment the state *) + (** Increment the state. *) module Incr = struct type t = unit let update () state = { value = state.value + 1 } end + (** Decrement the state. *) + module Incr = struct + type t = unit + + let update () state = { value = state.value - 1 } + end + module App = Make(struct type t = state end) - (* Create the event itself *) + (* Create the events *) let incr_event = App.E ((), (module Incr:App.Event with type t = Incr.t)) + let decr_event = App.E ((), (module Decr:App.Event with type t = Decr.t)) + + let init = { value = 0 } in + (* Run the main loop *) + let state = App.run + init + (E.select + [ incr_event + ; decr_event ] ) in … ] *) |