aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-02-07 16:09:14 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-02-07 16:15:44 +0100
commit5d5549c168af51195e66bf67cc5b23382b8c7d52 (patch)
tree6268ecee9135854b209a5533eeb99540b7955f31 /lib
parent58e892fb0159c42740ae92a642f7eb76245950a6 (diff)
Changed the organisation in the applications
Diffstat (limited to 'lib')
-rwxr-xr-xlib/application/application.ml9
-rwxr-xr-xlib/application/dune8
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/application/application.ml b/lib/application/application.ml
new file mode 100755
index 0000000..15452fb
--- /dev/null
+++ b/lib/application/application.ml
@@ -0,0 +1,9 @@
+(** The type for the applcation *)
+type ('a, 'b) t = 'a -> 'b -> 'b
+
+(** Simple helper for the main event loop *)
+let run
+ : ?eq:('b -> 'b -> bool) -> ('a, 'b) t -> 'b -> 'a Note.E.t -> 'b Note.S.t
+ = fun ?eq f init event ->
+ let action = Note.E.map f event in
+ Note.S.accum ?eq init action
diff --git a/lib/application/dune b/lib/application/dune
new file mode 100755
index 0000000..4661283
--- /dev/null
+++ b/lib/application/dune
@@ -0,0 +1,8 @@
+(library
+ (name application)
+ (libraries
+ brr
+ brr.note
+ elements
+ )
+ )