diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/application/application.ml | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/application/application.ml b/lib/application/application.ml index 789bd80..422aa4f 100755 --- a/lib/application/application.ml +++ b/lib/application/application.ml @@ -48,7 +48,7 @@ module Make(S:sig type t end) = struct type t - val update: t -> S.t -> S.t + val process: t -> S.t -> S.t end @@ -58,8 +58,16 @@ module Make(S:sig type t end) = struct 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 + let action = Note.E.map (fun (E (t, (module Event))) st -> Event.process t st) event in Note.S.accum ?eq init action + + let dispatch + : (module Event with type t = 's) -> 's -> event + = fun (type s) (module M: Event with type t = s) v -> + E + ( v + , (module M : Event with type t = M.t )) + end |