diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-09-20 22:27:04 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-09-20 22:27:04 +0200 |
commit | 3b90a643b3820e97bf1dab28ce41dacc4ca2831f (patch) | |
tree | d9155ffdb21f109f41b69438c87b5fb0b3ee41fb /src/application/application.ml | |
parent | 21d05774e5f78b6d070d69f714873b2c2a7cfe28 (diff) |
Updated from js usage
Diffstat (limited to 'src/application/application.ml')
-rwxr-xr-x | src/application/application.ml | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/application/application.ml b/src/application/application.ml deleted file mode 100755 index 01724ac..0000000 --- a/src/application/application.ml +++ /dev/null @@ -1,49 +0,0 @@ -(** The Make module build the main application loop.contents
-
- The function [run] update the state on each event, and return a new state.
- Each event must follow the [event] type, which is composed from the type
- [t], and a module with a fonction [update].
-
- This example create an application with the state containing a simple
- counter. An even which increment this counter is created and can be used to
- update the state.
-
-
- [
- type state = { value : int }
-
- (** Increment 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 *)
- let incr_event = App.E ((), (module Incr:App.Event with type t = Incr.t))
-
- ]
-
-*)
-module Make(S:sig type t end) = struct
- module type Event = sig
-
- type t
-
- val update: t -> S.t -> S.t
-
- end
-
- type event = E : 'a * (module Event with type t = 'a) -> event
-
- (** Simple helper for the main event loop *)
- let run
- : ?eq:(S.t -> S.t -> bool) -> S.t -> event Note.E.t -> S.t Note.S.t
- = fun ?eq init event ->
- let action = Note.E.map (fun (E (t, (module Event))) st -> Event.update t st) event in
- Note.S.accum ?eq init action
-end
-
-
|