/usr/share/doc/libreact-ocaml-dev/html/React.S.html is in libreact-ocaml-dev 1.2.0-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="React.E.html">
<link rel="next" href="React.Step.html">
<link rel="Up" href="React.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="React" rel="Chapter" href="React.html"><link title="Primitive and basics" rel="Section" href="#prim">
<link title="From events" rel="Section" href="#1_Fromevents">
<link title="Transforming and filtering" rel="Section" href="#tr">
<link title="Accumulating" rel="Section" href="#acc">
<link title="Combining" rel="Section" href="#combine">
<link title="Lifting" rel="Section" href="#lifting">
<link title="Combinator specialization" rel="Section" href="#special">
<title>React.S</title>
</head>
<body>
<div class="navbar"><a class="pre" href="React.E.html" title="React.E">Previous</a>
<a class="up" href="React.html" title="React">Up</a>
<a class="post" href="React.Step.html" title="React.Step">Next</a>
</div>
<h1>Module <a href="type_React.S.html">React.S</a></h1>
<pre><span class="keyword">module</span> S: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info module top">
Signal combinators.
<p>
Consult their <a href="React.html#sigsem">semantics.</a><br>
</div>
<hr width="100%">
<br>
<h1 id="prim">Primitive and basics</h1><br>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type">'a</code> t</span> = <code class="type">'a <a href="React.html#TYPEsignal">React.signal</a></code> </pre>
<div class="info ">
The type for signals of type <code class="code"><span class="keywordsign">'</span>a</code>.<br>
</div>
<pre><span id="VALconst"><span class="keyword">val</span> const</span> : <code class="type">'a -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">const v</code> is always <code class="code">v</code>, [<code class="code">const v</code>]<sub class="subscript">t</sub> <code class="code">= v</code>.<br>
</div>
<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> 'a -> 'a <a href="React.html#TYPEsignal">React.signal</a> * (?step:<a href="React.html#TYPEstep">React.step</a> -> 'a -> unit)</code></pre><div class="info ">
<code class="code">create i</code> is a primitive signal <code class="code">s</code> set to <code class="code">i</code> and a
<code class="code">set</code> function. The function <code class="code">set</code> is such that:
<ul>
<li><code class="code">set v</code> sets the signal's value to <code class="code">v</code> at the time it is called and
triggers an <a href="React.html#steps">update step</a>.</li>
<li><code class="code">set ~step v</code> sets the signal's value to <code class="code">v</code> at the time it is
called and updates it dependencies when <code class="code">step</code> is
<a href="React.Step.html#VALexecute">executed</a></li>
<li><code class="code">set ~step v</code> raises <code class="code"><span class="constructor">Invalid_argument</span></code> if it was previously
called with a step and this step has not executed yet or if
the given <code class="code">step</code> was already executed.</li>
</ul>
<b>Warning.</b> <code class="code">set</code> must not be executed inside an update step.<br>
</div>
<pre><span id="VALvalue"><span class="keyword">val</span> value</span> : <code class="type">'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a</code></pre><div class="info ">
<code class="code">value s</code> is <code class="code">s</code>'s current value.
<p>
<b>Warning.</b> If executed in an <a href="React.html#steps">update
step</a> may return a non up-to-date value or raise <code class="code"><span class="constructor">Failure</span></code> if
the signal is not yet initialized.<br>
</div>
<pre><span id="VALretain"><span class="keyword">val</span> retain</span> : <code class="type">'a <a href="React.html#TYPEsignal">React.signal</a> -> (unit -> unit) -> [ `R of unit -> unit ]</code></pre><div class="info ">
<code class="code">retain s c</code> keeps a reference to the closure <code class="code">c</code> in <code class="code">s</code> and
returns the previously retained value. <code class="code">c</code> will <em>never</em> be
invoked.
<p>
<b>Raises.</b> <code class="code"><span class="constructor">Invalid_argument</span></code> on constant signals.<br>
</div>
<pre><span id="VALstop"><span class="keyword">val</span> stop</span> : <code class="type">?strong:bool -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> unit</code></pre><div class="info ">
<code class="code">stop s</code>, stops updating <code class="code">s</code>. It conceptually becomes <a href="React.S.html#VALconst"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.const</code></a>
with the signal's last value and cannot be restarted. Allows to
disable <a href="React.html#sideeffects">effectful</a> signals.
<p>
The <code class="code">strong</code> argument should only be used on platforms
where weak arrays have a strong semantics (i.e. JavaScript).
See <a href="React.html#strongstop">details</a>.
<p>
<b>Note.</b> If executed in an update step the signal may
still update in the step.<br>
</div>
<pre><span id="VALequal"><span class="keyword">val</span> equal</span> : <code class="type">?eq:('a -> 'a -> bool) -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> bool</code></pre><div class="info ">
<code class="code">equal s s'</code> is <code class="code"><span class="keyword">true</span></code> iff <code class="code">s</code> and <code class="code">s'</code> are equal. If both
signals are <a href="React.S.html#VALconst"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.const</code></a>ant <code class="code">eq</code> is used between their value
(defauts to structural equality). If both signals are not
<a href="React.S.html#VALconst"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.const</code></a>ant, physical equality is used.<br>
</div>
<pre><span id="VALtrace"><span class="keyword">val</span> trace</span> : <code class="type">?iff:bool <a href="React.S.html#TYPEt">t</a> -> ('a -> unit) -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">trace iff tr s</code> is <code class="code">s</code> except <code class="code">tr</code> is invoked with <code class="code">s</code>'s
current value and on <code class="code">s</code> changes when <code class="code">iff</code> is <code class="code"><span class="keyword">true</span></code> (defaults
to <code class="code"><span class="constructor">S</span>.const <span class="keyword">true</span></code>). For all t where [<code class="code">s</code>]<sub class="subscript">t</sub> <code class="code">= v</code> and (t = 0
or ([<code class="code">s</code>]<sub class="subscript">t-dt</sub><code class="code">= v'</code> and <code class="code">eq v v' = <span class="keyword">false</span></code>)) and
[<code class="code">iff</code>]<sub class="subscript">t</sub> = <code class="code"><span class="keyword">true</span></code>, <code class="code">tr</code> is invoked with <code class="code">v</code>.<br>
</div>
<br>
<h1 id="1_Fromevents">From events</h1><br>
<pre><span id="VALhold"><span class="keyword">val</span> hold</span> : <code class="type">?eq:('a -> 'a -> bool) -> 'a -> 'a <a href="React.html#TYPEevent">React.event</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">hold i e</code> has the value of <code class="code">e</code>'s last occurrence or <code class="code">i</code> if there
wasn't any.
<ul>
<li>[<code class="code">hold i e</code>]<sub class="subscript">t</sub> <code class="code">= i</code> if [<code class="code">e</code>]<sub class="subscript"><=t</sub> <code class="code">= <span class="constructor">None</span></code></li>
<li>[<code class="code">hold i e</code>]<sub class="subscript">t</sub> <code class="code">= v</code> if [<code class="code">e</code>]<sub class="subscript"><=t</sub> <code class="code">= <span class="constructor">Some</span> v</code></li>
</ul>
<br>
</div>
<br>
<h1 id="tr">Transforming and filtering</h1><br>
<pre><span id="VALapp"><span class="keyword">val</span> app</span> : <code class="type">?eq:('b -> 'b -> bool) -><br> ('a -> 'b) <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'b <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">app sf s</code> holds the value of <code class="code">sf</code> applied
to the value of <code class="code">s</code>, [<code class="code">app sf s</code>]<sub class="subscript">t</sub>
<code class="code">=</code> [<code class="code">sf</code>]<sub class="subscript">t</sub> [<code class="code">s</code>]<sub class="subscript">t</sub>.<br>
</div>
<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">?eq:('b -> 'b -> bool) -> ('a -> 'b) -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'b <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">map f s</code> is <code class="code">s</code> transformed by <code class="code">f</code>, [<code class="code">map f s</code>]<sub class="subscript">t</sub> = <code class="code">f</code> [<code class="code">s</code>]<sub class="subscript">t</sub>.<br>
</div>
<pre><span id="VALfilter"><span class="keyword">val</span> filter</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> ('a -> bool) -> 'a -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">filter f i s</code> is <code class="code">s</code>'s values that satisfy <code class="code">p</code>. If a value does not
satisfy <code class="code">p</code> it holds the last value that was satisfied or <code class="code">i</code> if
there is none.
<ul>
<li>[<code class="code">filter p s</code>]<sub class="subscript">t</sub> <code class="code">=</code> [<code class="code">s</code>]<sub class="subscript">t</sub> if <code class="code">p</code> [<code class="code">s</code>]<sub class="subscript">t</sub><code class="code"> = <span class="keyword">true</span></code>.</li>
<li>[<code class="code">filter p s</code>]<sub class="subscript">t</sub> <code class="code">=</code> [<code class="code">s</code>]<sub class="subscript">t'</sub> if <code class="code">p</code> [<code class="code">s</code>]<sub class="subscript">t</sub><code class="code"> = <span class="keyword">false</span></code>
and t' is the greatest t' < t with <code class="code">p</code> [<code class="code">s</code>]<sub class="subscript">t'</sub><code class="code"> = <span class="keyword">true</span></code>.</li>
<li>[<code class="code">filter p e</code>]<sub class="subscript">t</sub> <code class="code">= i</code> otherwise.</li>
</ul>
<br>
</div>
<pre><span id="VALfmap"><span class="keyword">val</span> fmap</span> : <code class="type">?eq:('b -> 'b -> bool) -><br> ('a -> 'b option) -> 'b -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'b <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">fmap fm i s</code> is <code class="code">s</code> filtered and mapped by <code class="code">fm</code>.
<ul>
<li>[<code class="code">fmap fm i s</code>]<sub class="subscript">t</sub> <code class="code">=</code> v if <code class="code">fm</code> [<code class="code">s</code>]<sub class="subscript">t</sub><code class="code"> = <span class="constructor">Some</span> v</code>.</li>
<li>[<code class="code">fmap fm i s</code>]<sub class="subscript">t</sub> <code class="code">=</code> [<code class="code">fmap fm i s</code>]<sub class="subscript">t'</sub> if <code class="code">fm</code>
[<code class="code">s</code>]<sub class="subscript">t</sub> <code class="code">= <span class="constructor">None</span></code> and t' is the greatest t' < t with <code class="code">fm</code>
[<code class="code">s</code>]<sub class="subscript">t'</sub> <code class="code"><> <span class="constructor">None</span></code>.</li>
<li>[<code class="code">fmap fm i s</code>]<sub class="subscript">t</sub> <code class="code">= i</code> otherwise.</li>
</ul>
<br>
</div>
<pre><span id="VALdiff"><span class="keyword">val</span> diff</span> : <code class="type">('a -> 'a -> 'b) -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'b <a href="React.html#TYPEevent">React.event</a></code></pre><div class="info ">
<code class="code">diff f s</code> is an event with occurrences whenever <code class="code">s</code> changes from
<code class="code">v'</code> to <code class="code">v</code> and <code class="code">eq v v'</code> is <code class="code"><span class="keyword">false</span></code> (<code class="code">eq</code> is the signal's equality
function). The value of the occurrence is <code class="code">f v v'</code>.
<ul>
<li>[<code class="code">diff f s</code>]<sub class="subscript">t</sub> <code class="code">= <span class="constructor">Some</span> d</code>
if [<code class="code">s</code>]<sub class="subscript">t</sub> <code class="code">= v</code> and [<code class="code">s</code>]<sub class="subscript">t-dt</sub> <code class="code">= v'</code> and <code class="code">eq v v' = <span class="keyword">false</span></code>
and <code class="code">f v v' = d</code>.</li>
<li>[<code class="code">diff f s</code>]<sub class="subscript">t</sub> <code class="code">= <span class="constructor">None</span></code> otherwise.</li>
</ul>
<br>
</div>
<pre><span id="VALchanges"><span class="keyword">val</span> changes</span> : <code class="type">'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEevent">React.event</a></code></pre><div class="info ">
<code class="code">changes s</code> is <code class="code">diff (<span class="keyword">fun</span> v _ <span class="keywordsign">-></span> v) s</code>.<br>
</div>
<pre><span id="VALsample"><span class="keyword">val</span> sample</span> : <code class="type">('b -> 'a -> 'c) -> 'b <a href="React.html#TYPEevent">React.event</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'c <a href="React.html#TYPEevent">React.event</a></code></pre><div class="info ">
<code class="code">sample f e s</code> samples <code class="code">s</code> at <code class="code">e</code>'s occurrences.
<ul>
<li>[<code class="code">sample f e s</code>]<sub class="subscript">t</sub> <code class="code">= <span class="constructor">Some</span> (f ev sv)</code> if [<code class="code">e</code>]<sub class="subscript">t</sub> <code class="code">= <span class="constructor">Some</span> ev</code>
and [<code class="code">s</code>]<sub class="subscript">t</sub> <code class="code">= sv</code>.</li>
<li>[<code class="code">sample e s</code>]<sub class="subscript">t</sub> <code class="code">= <span class="constructor">None</span></code> otherwise.</li>
</ul>
<br>
</div>
<pre><span id="VALon"><span class="keyword">val</span> on</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> bool <a href="React.html#TYPEsignal">React.signal</a> -> 'a -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">on c i s</code> is the signal <code class="code">s</code> whenever <code class="code">c</code> is <code class="code"><span class="keyword">true</span></code>.
When <code class="code">c</code> is <code class="code"><span class="keyword">false</span></code> it holds the last value <code class="code">s</code> had when
<code class="code">c</code> was the last time <code class="code"><span class="keyword">true</span></code> or <code class="code">i</code> if it never was.
<ul>
<li>[<code class="code">on c i s</code>]<sub class="subscript">t</sub> <code class="code">=</code> [<code class="code">s</code>]<sub class="subscript">t</sub> if [<code class="code">c</code>]<sub class="subscript">t</sub> <code class="code">= <span class="keyword">true</span></code></li>
<li>[<code class="code">on c i s</code>]<sub class="subscript">t</sub> <code class="code">=</code> [<code class="code">s</code>]<sub class="subscript">t'</sub> if [<code class="code">c</code>]<sub class="subscript">t</sub> <code class="code">= <span class="keyword">false</span></code>
where t' is the greatest t' < t with [<code class="code">c</code>]<sub class="subscript">t'</sub> <code class="code">= <span class="keyword">true</span></code>.</li>
<li>[<code class="code">on c i s</code>]<sub class="subscript">t</sub> <code class="code">=</code> <code class="code">i</code> otherwise.</li>
</ul>
<br>
</div>
<pre><span id="VALwhen_"><span class="keyword">val</span> when_</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> bool <a href="React.html#TYPEsignal">React.signal</a> -> 'a -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<span class="warning">Deprecated.</span>Use <a href="React.S.html#VALon"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.on</code></a>.<br>
</div>
<pre><span id="VALdismiss"><span class="keyword">val</span> dismiss</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> 'b <a href="React.html#TYPEevent">React.event</a> -> 'a -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">dismiss c i s</code> is the signal <code class="code">s</code> except changes when <code class="code">c</code> occurs
are ignored. If <code class="code">c</code> occurs initially <code class="code">i</code> is used.
<ul>
<li>[<code class="code">dismiss c i s</code>]<sub class="subscript">t</sub> <code class="code">=</code> [<code class="code">s</code>]<sub class="subscript">t'</sub>
where t' is the greatest t' <= t with [<code class="code">c</code>]<sub class="subscript">t'</sub> <code class="code">= <span class="constructor">None</span></code> and
[<code class="code">s</code>]<sub class="subscript">t'-dt</sub> <code class="code"><></code> [<code class="code">s</code>]<sub class="subscript">t'</sub></li>
<li>[<code class="code">dismiss_ c i s</code>]<sub class="subscript">0</sub> <code class="code">=</code> <code class="code">v</code> where <code class="code">v = i</code> if
[<code class="code">c</code>]<sub class="subscript">0</sub> <code class="code">= <span class="constructor">Some</span> _</code> and <code class="code">v =</code> [<code class="code">s</code>]<sub class="subscript">0</sub> otherwise.</li>
</ul>
<br>
</div>
<br>
<h1 id="acc">Accumulating</h1><br>
<pre><span id="VALaccum"><span class="keyword">val</span> accum</span> : <code class="type">?eq:('a -> 'a -> bool) -> ('a -> 'a) <a href="React.html#TYPEevent">React.event</a> -> 'a -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">accum e i</code> is <code class="code"><span class="constructor">S</span>.hold i (</code><a href="React.E.html#VALaccum"><code class="code"><span class="constructor">React</span>.<span class="constructor">E</span>.accum</code></a><code class="code"> e i)</code>.<br>
</div>
<pre><span id="VALfold"><span class="keyword">val</span> fold</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> ('a -> 'b -> 'a) -> 'a -> 'b <a href="React.html#TYPEevent">React.event</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">fold f i e</code> is <code class="code"><span class="constructor">S</span>.hold i (</code><a href="React.E.html#VALfold"><code class="code"><span class="constructor">React</span>.<span class="constructor">E</span>.fold</code></a><code class="code"> f i e)</code>.<br>
</div>
<br>
<h1 id="combine">Combining</h1><br>
<pre><span id="VALmerge"><span class="keyword">val</span> merge</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> ('a -> 'b -> 'a) -> 'a -> 'b <a href="React.html#TYPEsignal">React.signal</a> list -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">merge f a sl</code> merges the value of every signal in <code class="code">sl</code>
using <code class="code">f</code> and the accumulator <code class="code">a</code>.
<p>
[<code class="code">merge f a sl</code>]<sub class="subscript">t</sub>
<code class="code">= <span class="constructor">List</span>.fold_left f a (<span class="constructor">List</span>.map</code> []<sub class="subscript">t</sub><code class="code"> sl)</code>.<br>
</div>
<pre><span id="VALswitch"><span class="keyword">val</span> switch</span> : <code class="type">?eq:('a -> 'a -> bool) -> 'a <a href="React.html#TYPEsignal">React.signal</a> <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">switch ss</code> is the inner signal of <code class="code">ss</code>.
<ul>
<li>[<code class="code">switch ss</code>]<sub class="subscript">t</sub> <code class="code">=</code> [[<code class="code">ss</code>]<sub class="subscript">t</sub>]<sub class="subscript">t</sub>.</li>
</ul>
<br>
</div>
<pre><span id="VALbind"><span class="keyword">val</span> bind</span> : <code class="type">?eq:('b -> 'b -> bool) -><br> 'a <a href="React.html#TYPEsignal">React.signal</a> -> ('a -> 'b <a href="React.html#TYPEsignal">React.signal</a>) -> 'b <a href="React.html#TYPEsignal">React.signal</a></code></pre><div class="info ">
<code class="code">bind s sf</code> is <code class="code">switch (map ~eq:( == ) sf s)</code>.<br>
</div>
<pre><span id="VALfix"><span class="keyword">val</span> fix</span> : <code class="type">?eq:('a -> 'a -> bool) -><br> 'a -> ('a <a href="React.html#TYPEsignal">React.signal</a> -> 'a <a href="React.html#TYPEsignal">React.signal</a> * 'b) -> 'b</code></pre><div class="info ">
<code class="code">fix i sf</code> allow to refer to the value a signal had an
infinitesimal amount of time before.
<p>
In <code class="code">fix sf</code>, <code class="code">sf</code> is called with a signal <code class="code">s</code> that represents
the signal returned by <code class="code">sf</code> delayed by an infinitesimal amount
time. If <code class="code">s', r = sf s</code> then <code class="code">r</code> is returned by <code class="code">fix</code> and <code class="code">s</code>
is such that :
<ul>
<li>[<code class="code">s</code>]<sub class="subscript">t</sub> <code class="code">=</code> <code class="code">i</code> for t = 0. </li>
<li>[<code class="code">s</code>]<sub class="subscript">t</sub> <code class="code">=</code> [<code class="code">s'</code>]<sub class="subscript">t-dt</sub> otherwise.</li>
</ul>
<p>
<code class="code">eq</code> is the equality used by <code class="code">s</code>.
<p>
<b>Raises.</b> <code class="code"><span class="constructor">Invalid_argument</span></code> if <code class="code">s'</code> is directly a delayed signal (i.e.
a signal given to a fixing function).
<p>
<b>Note.</b> Regarding values depending on the result <code class="code">r</code> of
<code class="code">s', r = sf s</code> the following two cases need to be distinguished :
<ul>
<li>After <code class="code">sf s</code> is applied, <code class="code">s'</code> does not depend on
a value that is in a step and <code class="code">s</code> has no dependents in a step (e.g
in the simple case where <code class="code">fix</code> is applied outside a step).
<p>
In that case if the initial value of <code class="code">s'</code> differs from <code class="code">i</code>,
<code class="code">s</code> and its dependents need to be updated and a special
update step will be triggered for this. Values
depending on the result <code class="code">r</code> will be created only after this
special update step has finished (e.g. they won't see
the <code class="code">i</code> of <code class="code">s</code> if <code class="code">r = s</code>).</li>
<li>Otherwise, values depending on <code class="code">r</code> will be created in the same
step as <code class="code">s</code> and <code class="code">s'</code> (e.g. they will see the <code class="code">i</code> of <code class="code">s</code> if <code class="code">r = s</code>).</li>
</ul>
<br>
</div>
<br>
<h1 id="lifting">Lifting</h1>
<p>
Lifting combinators. For a given <code class="code">n</code> the semantics is :
<p>
[<code class="code">ln f a1</code> ... <code class="code">an</code>]<sub class="subscript">t</sub> = f [<code class="code">a1</code>]<sub class="subscript">t</sub> ... [<code class="code">an</code>]<sub class="subscript">t</sub><br>
<pre><span id="VALl1"><span class="keyword">val</span> l1</span> : <code class="type">?eq:('b -> 'b -> bool) -> ('a -> 'b) -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'b <a href="React.html#TYPEsignal">React.signal</a></code></pre>
<pre><span id="VALl2"><span class="keyword">val</span> l2</span> : <code class="type">?eq:('c -> 'c -> bool) -><br> ('a -> 'b -> 'c) -> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'b <a href="React.html#TYPEsignal">React.signal</a> -> 'c <a href="React.html#TYPEsignal">React.signal</a></code></pre>
<pre><span id="VALl3"><span class="keyword">val</span> l3</span> : <code class="type">?eq:('d -> 'd -> bool) -><br> ('a -> 'b -> 'c -> 'd) -><br> 'a <a href="React.html#TYPEsignal">React.signal</a> -> 'b <a href="React.html#TYPEsignal">React.signal</a> -> 'c <a href="React.html#TYPEsignal">React.signal</a> -> 'd <a href="React.html#TYPEsignal">React.signal</a></code></pre>
<pre><span id="VALl4"><span class="keyword">val</span> l4</span> : <code class="type">?eq:('e -> 'e -> bool) -><br> ('a -> 'b -> 'c -> 'd -> 'e) -><br> 'a <a href="React.html#TYPEsignal">React.signal</a> -><br> 'b <a href="React.html#TYPEsignal">React.signal</a> -> 'c <a href="React.html#TYPEsignal">React.signal</a> -> 'd <a href="React.html#TYPEsignal">React.signal</a> -> 'e <a href="React.html#TYPEsignal">React.signal</a></code></pre>
<pre><span id="VALl5"><span class="keyword">val</span> l5</span> : <code class="type">?eq:('f -> 'f -> bool) -><br> ('a -> 'b -> 'c -> 'd -> 'e -> 'f) -><br> 'a <a href="React.html#TYPEsignal">React.signal</a> -><br> 'b <a href="React.html#TYPEsignal">React.signal</a> -><br> 'c <a href="React.html#TYPEsignal">React.signal</a> -> 'd <a href="React.html#TYPEsignal">React.signal</a> -> 'e <a href="React.html#TYPEsignal">React.signal</a> -> 'f <a href="React.html#TYPEsignal">React.signal</a></code></pre>
<pre><span id="VALl6"><span class="keyword">val</span> l6</span> : <code class="type">?eq:('g -> 'g -> bool) -><br> ('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g) -><br> 'a <a href="React.html#TYPEsignal">React.signal</a> -><br> 'b <a href="React.html#TYPEsignal">React.signal</a> -><br> 'c <a href="React.html#TYPEsignal">React.signal</a> -><br> 'd <a href="React.html#TYPEsignal">React.signal</a> -> 'e <a href="React.html#TYPEsignal">React.signal</a> -> 'f <a href="React.html#TYPEsignal">React.signal</a> -> 'g <a href="React.html#TYPEsignal">React.signal</a></code></pre><br>
The following modules lift some of <code class="code"><span class="constructor">Pervasives</span></code> functions and
operators.<br>
<pre><span class="keyword">module</span> <a href="React.S.Bool.html">Bool</a>: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.Bool.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>
<pre><span class="keyword">module</span> <a href="React.S.Int.html">Int</a>: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.Int.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>
<pre><span class="keyword">module</span> <a href="React.S.Float.html">Float</a>: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.Float.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>
<pre><span class="keyword">module</span> <a href="React.S.Pair.html">Pair</a>: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.Pair.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>
<pre><span class="keyword">module</span> <a href="React.S.Option.html">Option</a>: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.Option.html">..</a> <code class="code"><span class="keyword">end</span></code></pre>
<pre><span class="keyword">module</span> <a href="React.S.Compare.html">Compare</a>: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.Compare.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><br>
<h1 id="special">Combinator specialization</h1>
<p>
Given an equality function <code class="code">equal</code> and a type <code class="code">t</code>, the functor
<a href="React.S.Make.html"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.<span class="constructor">Make</span></code></a> automatically applies the <code class="code">eq</code> parameter of the combinators.
The outcome is combinators whose <em>results</em> are signals with
values in <code class="code">t</code>.
<p>
Basic types are already specialized in the module <a href="React.S.Special.html"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.<span class="constructor">Special</span></code></a>, open
this module to use them.<br>
<pre><span class="keyword">module type</span> <a href="React.S.EqType.html">EqType</a> = <code class="code"><span class="keyword">sig</span></code> <a href="React.S.EqType.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Input signature of <a href="React.S.Make.html"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.<span class="constructor">Make</span></code></a>
</div>
<pre><span class="keyword">module type</span> <a href="React.S.S.html">S</a> = <code class="code"><span class="keyword">sig</span></code> <a href="React.S.S.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Output signature of <a href="React.S.Make.html"><code class="code"><span class="constructor">React</span>.<span class="constructor">S</span>.<span class="constructor">Make</span></code></a>
</div>
<pre><span class="keyword">module</span> <a href="React.S.Make.html">Make</a>: <div class="sig_block"><code class="code"><span class="keyword">functor</span> (</code><code class="code"><span class="constructor">Eq</span></code><code class="code"> : </code><code class="type"><a href="React.S.EqType.html">EqType</a></code><code class="code">) <span class="keywordsign">-></span> </code><code class="type"><a href="React.S.S.html">S</a></code><code class="type"> with type 'a v = 'a Eq.t</code></div></pre><div class="info">
Functor specializing the combinators for the given signal value type
</div>
<pre><span class="keyword">module</span> <a href="React.S.Special.html">Special</a>: <code class="code"><span class="keyword">sig</span></code> <a href="React.S.Special.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><div class="info">
Specialization for booleans, integers and floats.
</div>
</body></html>
|