Source file bonsai_extra_proc.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
open! Core
module Bonsai = Bonsai.Cont
open Bonsai.Let_syntax
let with_inject_fixed_point f (local_ graph) =
let f inject (local_ graph) =
let%sub a, b = f inject graph in
a, b
in
let result = Bonsai_extra.Fixed_point.with_inject_fixed_point f graph in
result
;;
let with_self_effect ?sexp_of_model ?equal ~f () (local_ graph) =
Bonsai_extra.Fixed_point.with_self_effect ?sexp_of_model ?equal ~f graph
;;
let pipe ?sexp_of (local_ graph) =
let enqueue, dequeue = Bonsai_extra.Pipe.pipe ?sexp_of graph in
Bonsai.both enqueue dequeue
;;
let exactly_once effect (local_ graph) =
Bonsai_extra.Effects.exactly_once effect graph;
Bonsai.return ()
;;
let exactly_once_with_value = Bonsai_extra.Effects.exactly_once_with_value
let value_with_override ?sexp_of_model ?equal value (local_ graph) =
let value, override =
Bonsai_extra.Value_utilities.value_with_override ?sexp_of_model ?equal value graph
in
Bonsai.both value override
;;
let state_machine0_dynamic_model
?sexp_of_action
?sexp_of_model
?equal
~model
~apply_action
()
(local_ graph)
=
let result, inject =
Bonsai_extra.State_machine.state_machine0_dynamic_model
?sexp_of_action
?sexp_of_model
?equal
~model
~apply_action
graph
in
Bonsai.both result inject
;;
let state_machine1_dynamic_model
?sexp_of_action
?sexp_of_model
?equal
~model
~apply_action
input
(local_ graph)
=
let result, inject =
Bonsai_extra.State_machine.state_machine1_dynamic_model
?sexp_of_action
?sexp_of_model
?equal
~model
~apply_action
input
graph
in
Bonsai.both result inject
;;
let state_dynamic_model ?sexp_of_model ?equal ~model () (local_ graph) =
let result, inject =
Bonsai_extra.State_machine.state_dynamic_model ?sexp_of_model ?equal ~model graph
in
Bonsai.both result inject
;;
module Id_gen (T : Int_intf.S) () = struct
include Bonsai_extra.Id_gen (T) ()
let component' ?reset (local_ graph) =
let generate, newest = component' ?reset graph in
Bonsai.both generate newest
;;
end
let mirror'
?sexp_of_model
~equal
~store_set
~store_value
~interactive_set
~interactive_value
()
(local_ graph)
=
Bonsai_extra.Mirror.mirror'
?sexp_of_model
~equal
~store_set
~store_value
~interactive_set
~interactive_value
graph;
Bonsai.return ()
;;
let mirror
?sexp_of_model
~equal
~store_set
~store_value
~interactive_set
~interactive_value
()
(local_ graph)
=
Bonsai_extra.Mirror.mirror
?sexp_of_model
~equal
~store_set
~store_value
~interactive_set
~interactive_value
graph;
Bonsai.return ()
;;
let with_last_modified_time ~equal input (local_ graph) =
let value, time =
Bonsai_extra.Value_stability.with_last_modified_time ~equal input graph
in
Bonsai.both value time
;;
let is_stable = Bonsai_extra.Value_stability.is_stable
module Stability = Bonsai_extra.Value_stability.Stability
let value_stability = Bonsai_extra.Value_stability.value_stability
module One_at_a_time = struct
include Bonsai_extra.One_at_a_time
let effect send_effect (local_ graph) =
let send, status = effect send_effect graph in
Bonsai.both send status
;;
end
let bonk = Bonsai_extra.Effects.bonk
let chain_incr_effects = Bonsai_extra.Effects.chain_incr_effects