ruff 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/docs/Ruff.html +18 -7
- data/docs/Ruff/Effect.html +13 -13
- data/docs/Ruff/Handler.html +26 -24
- data/docs/Ruff/Throws.html +9 -6
- data/docs/Ruff/Throws/Eff.html +12 -12
- data/docs/Ruff/Throws/Resend.html +15 -15
- data/docs/_index.html +4 -4
- data/docs/file.README.html +11 -3
- data/docs/frames.html +1 -1
- data/docs/index.html +11 -3
- data/docs/top-level-namespace.html +3 -3
- data/lib/ruff/effect.rb +19 -21
- data/lib/ruff/handler.rb +89 -90
- data/lib/ruff/objects.rb +24 -30
- data/lib/ruff/version.rb +1 -1
- data/version.h +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91f24bc9d41ba7b08fe795a8dd52ec1cc76b9eb3d9a510310f2eea826627b839
|
4
|
+
data.tar.gz: a749e0b9e91d890a905f905a02c85981050b1cc557c73d2d8a34fe221cde9283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e902920988c2efb254d735425a2484728a236001d2caa8bdd23adcf6eacca5bc36f848865dac5c58f84dae7a105efe9143b211f2c7e70fd4b7a5edafdd9b386
|
7
|
+
data.tar.gz: 43c685ac4c07cb91df80e361bc8d3e38e317915f129265bc84866d3133192b73f42e76c09a4aace19296c30781102fbaae8810114d1b46f6c7227dcfa5bcaf49
|
data/Gemfile.lock
CHANGED
data/docs/Ruff.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Ruff
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -78,14 +78,25 @@
|
|
78
78
|
|
79
79
|
<dl>
|
80
80
|
<dt>Defined in:</dt>
|
81
|
-
<dd>lib/ruff.rb<span class="defines">,<br />
|
82
|
-
lib/ruff
|
81
|
+
<dd>lib/ruff/version.cpp.rb<span class="defines">,<br />
|
82
|
+
lib/ruff.rb,<br /> lib/ruff/version.rb</span>
|
83
83
|
</dd>
|
84
84
|
</dl>
|
85
85
|
|
86
86
|
</div>
|
87
87
|
|
88
|
-
<h2>
|
88
|
+
<h2>Overview</h2><div class="docstring">
|
89
|
+
<div class="discussion">
|
90
|
+
<p>// This file is passed to CPP
|
91
|
+
include "../../version.h"</p>
|
92
|
+
|
93
|
+
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<div class="tags">
|
97
|
+
|
98
|
+
|
99
|
+
</div><h2>Defined Under Namespace</h2>
|
89
100
|
<p class="children">
|
90
101
|
|
91
102
|
|
@@ -109,7 +120,7 @@
|
|
109
120
|
<dt id="VERSION-constant" class="">VERSION =
|
110
121
|
|
111
122
|
</dt>
|
112
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.
|
123
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.6</span><span class='tstring_end'>"</span></span></pre></dd>
|
113
124
|
|
114
125
|
</dl>
|
115
126
|
|
@@ -301,9 +312,9 @@
|
|
301
312
|
</div>
|
302
313
|
|
303
314
|
<div id="footer">
|
304
|
-
Generated on Wed
|
315
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
305
316
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
306
|
-
0.9.20 (ruby-2.6.
|
317
|
+
0.9.20 (ruby-2.6.4).
|
307
318
|
</div>
|
308
319
|
|
309
320
|
</div>
|
data/docs/Ruff/Effect.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Ruff::Effect
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -244,13 +244,13 @@
|
|
244
244
|
<pre class="lines">
|
245
245
|
|
246
246
|
|
247
|
+
10
|
247
248
|
11
|
248
249
|
12
|
249
|
-
13
|
250
|
-
14</pre>
|
250
|
+
13</pre>
|
251
251
|
</td>
|
252
252
|
<td>
|
253
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/effect.rb', line
|
253
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/effect.rb', line 10</span>
|
254
254
|
|
255
255
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
256
256
|
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='const'>SecureRandom</span><span class='period'>.</span><span class='id identifier rubyid_uuid'>uuid</span>
|
@@ -293,12 +293,12 @@
|
|
293
293
|
<pre class="lines">
|
294
294
|
|
295
295
|
|
296
|
+
4
|
296
297
|
5
|
297
|
-
6
|
298
|
-
7</pre>
|
298
|
+
6</pre>
|
299
299
|
</td>
|
300
300
|
<td>
|
301
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/effect.rb', line
|
301
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/effect.rb', line 4</span>
|
302
302
|
|
303
303
|
<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
|
304
304
|
<span class='ivar'>@id</span>
|
@@ -384,15 +384,15 @@
|
|
384
384
|
<pre class="lines">
|
385
385
|
|
386
386
|
|
387
|
+
20
|
387
388
|
21
|
388
|
-
22
|
389
|
-
23</pre>
|
389
|
+
22</pre>
|
390
390
|
</td>
|
391
391
|
<td>
|
392
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/effect.rb', line
|
392
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/effect.rb', line 20</span>
|
393
393
|
|
394
394
|
<span class='kw'>def</span> <span class='id identifier rubyid_perform'>perform</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span>
|
395
|
-
<span class='kw'>return</span> <span class='const'>Fiber</span><span class='period'>.</span><span class='id identifier rubyid_yield'>yield</span> <span class='const'><span class='object_link'><a href="Throws.html" title="Ruff::Throws (module)">Throws</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Throws/Eff.html" title="Ruff::Throws::Eff (class)">Eff</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Throws/Eff.html#initialize-instance_method" title="Ruff::Throws::Eff#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@id</span><span class='comma'>,</span> <span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span>
|
395
|
+
<span class='kw'>return</span> <span class='const'>Fiber</span><span class='period'>.</span><span class='id identifier rubyid_yield'>yield</span> <span class='const'><span class='object_link'><a href="../Ruff.html" title="Ruff (module)">Ruff</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Throws.html" title="Ruff::Throws (module)">Throws</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Throws/Eff.html" title="Ruff::Throws::Eff (class)">Eff</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Throws/Eff.html#initialize-instance_method" title="Ruff::Throws::Eff#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='ivar'>@id</span><span class='comma'>,</span> <span class='id identifier rubyid_a'>a</span><span class='rparen'>)</span>
|
396
396
|
<span class='kw'>end</span></pre>
|
397
397
|
</td>
|
398
398
|
</tr>
|
@@ -404,9 +404,9 @@
|
|
404
404
|
</div>
|
405
405
|
|
406
406
|
<div id="footer">
|
407
|
-
Generated on Wed
|
407
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
408
408
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
409
|
-
0.9.20 (ruby-2.6.
|
409
|
+
0.9.20 (ruby-2.6.4).
|
410
410
|
</div>
|
411
411
|
|
412
412
|
</div>
|
data/docs/Ruff/Handler.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Ruff::Handler
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -87,6 +87,11 @@
|
|
87
87
|
|
88
88
|
|
89
89
|
|
90
|
+
<dl>
|
91
|
+
<dt>Includes:</dt>
|
92
|
+
<dd><span class='object_link'><a href="Throws.html" title="Ruff::Throws (module)">Throws</a></span></dd>
|
93
|
+
</dl>
|
94
|
+
|
90
95
|
|
91
96
|
|
92
97
|
|
@@ -99,17 +104,7 @@
|
|
99
104
|
|
100
105
|
</div>
|
101
106
|
|
102
|
-
<h2>Overview</h2><div class="docstring">
|
103
|
-
<div class="discussion">
|
104
|
-
<p>In algebraic effects, handler is an first-class object.</p>
|
105
|
-
|
106
|
-
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
<div class="tags">
|
110
|
-
|
111
107
|
|
112
|
-
</div>
|
113
108
|
|
114
109
|
|
115
110
|
|
@@ -143,7 +138,7 @@
|
|
143
138
|
|
144
139
|
|
145
140
|
|
146
|
-
<span class="summary_desc"><div class='inline'><p>
|
141
|
+
<span class="summary_desc"><div class='inline'><p>In algebraic effects, handler is an first-class object.</p>
|
147
142
|
</div></span>
|
148
143
|
|
149
144
|
</li>
|
@@ -198,7 +193,13 @@
|
|
198
193
|
</ul>
|
199
194
|
|
200
195
|
|
201
|
-
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
<div id="constructor_details" class="method_details_list">
|
202
203
|
<h2>Constructor Details</h2>
|
203
204
|
|
204
205
|
<div class="method_details first">
|
@@ -212,7 +213,8 @@
|
|
212
213
|
|
213
214
|
</h3><div class="docstring">
|
214
215
|
<div class="discussion">
|
215
|
-
<p>
|
216
|
+
<p>In algebraic effects, handler is an first-class object.
|
217
|
+
makes a new handler, internally having fresh empty hash.
|
216
218
|
This is a effect-handler store and when handliong it is looked up.</p>
|
217
219
|
|
218
220
|
|
@@ -279,7 +281,7 @@ This is a effect-handler store and when handliong it is looked up.</p>
|
|
279
281
|
<p class="tag_title">Examples:</p>
|
280
282
|
|
281
283
|
|
282
|
-
<pre class="example code"><code><span class='id identifier rubyid_handler'>handler</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='const'>Log</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier
|
284
|
+
<pre class="example code"><code><span class='id identifier rubyid_handler'>handler</span><span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='const'>Log</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_msg'>msg</span><span class='op'>|</span>
|
283
285
|
<span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Logger: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_msg'>msg</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
284
286
|
<span class='id identifier rubyid_k'>k</span><span class='lbracket'>[</span><span class='rbracket'>]</span>
|
285
287
|
<span class='rbrace'>}</span></code></pre>
|
@@ -314,7 +316,7 @@ This is a effect-handler store and when handliong it is looked up.</p>
|
|
314
316
|
|
315
317
|
—
|
316
318
|
<div class='inline'><p>a handler to handle <code>eff</code>;
|
317
|
-
|
319
|
+
First argument of <code>&prc</code> is <em>continuation</em>, proc object
|
318
320
|
to go back to the handled computation.</p>
|
319
321
|
</div>
|
320
322
|
|
@@ -397,7 +399,7 @@ to go back to the handled computation.</p>
|
|
397
399
|
|
398
400
|
<pre class="example code"><code><span class='id identifier rubyid_handler'>handler</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span> <span class='lbrace'>{</span>
|
399
401
|
<span class='const'><span class='object_link'><a href="" title="Ruff::Handler (class)">Handler</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="Ruff::Handler#initialize (method)">new</a></span></span>
|
400
|
-
<span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='const'>Double</span><span class='rparen'>)</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier
|
402
|
+
<span class='period'>.</span><span class='id identifier rubyid_on'>on</span><span class='lparen'>(</span><span class='const'>Double</span><span class='rparen'>)</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
401
403
|
<span class='id identifier rubyid_k'>k</span><span class='lbracket'>[</span><span class='id identifier rubyid_v'>v</span> <span class='op'>*</span> <span class='id identifier rubyid_v'>v</span><span class='rbracket'>]</span>
|
402
404
|
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span> <span class='lbrace'>{</span>
|
403
405
|
<span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='const'>Double</span><span class='period'>.</span><span class='id identifier rubyid_perform'>perform</span> <span class='int'>3</span>
|
@@ -411,7 +413,7 @@ to go back to the handled computation.</p>
|
|
411
413
|
|
412
414
|
<li>
|
413
415
|
|
414
|
-
<span class='name'
|
416
|
+
<span class='name'>prc</span>
|
415
417
|
|
416
418
|
|
417
419
|
<span class='type'>(<tt>Proc<(), T></tt>)</span>
|
@@ -504,17 +506,17 @@ to go back to the handled computation.</p>
|
|
504
506
|
<span class='id identifier rubyid_rehandles'>rehandles</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
505
507
|
|
506
508
|
<span class='id identifier rubyid_handle'>handle</span> <span class='op'>=</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_r'>r</span><span class='rparen'>)</span> <span class='tlambeg'>{</span>
|
507
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="Throws
|
509
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="Throws/Eff.html" title="Ruff::Throws::Eff (class)">Eff</a></span></span>
|
508
510
|
<span class='kw'>if</span> <span class='id identifier rubyid_effh'>effh</span> <span class='op'>=</span> <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span>
|
509
511
|
<span class='id identifier rubyid_effh'>effh</span><span class='lbracket'>[</span><span class='id identifier rubyid_continue'>continue</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_args'>args</span><span class='rbracket'>]</span>
|
510
512
|
<span class='kw'>else</span>
|
511
|
-
<span class='const'>Fiber</span><span class='period'>.</span><span class='id identifier rubyid_yield'>yield</span> <span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Throws
|
513
|
+
<span class='const'>Fiber</span><span class='period'>.</span><span class='id identifier rubyid_yield'>yield</span> <span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Throws/Resend.html" title="Ruff::Throws::Resend (class)">Resend</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Throws/Resend.html#initialize-instance_method" title="Ruff::Throws::Resend#initialize (method)">new</a></span></span> <span class='id identifier rubyid_r'>r</span><span class='comma'>,</span> <span class='id identifier rubyid_continue'>continue</span><span class='rparen'>)</span>
|
512
514
|
<span class='kw'>end</span>
|
513
|
-
<span class='kw'>elsif</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="Throws
|
515
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'><span class='object_link'><a href="Throws/Resend.html" title="Ruff::Throws::Resend (class)">Resend</a></span></span>
|
514
516
|
<span class='kw'>if</span> <span class='id identifier rubyid_effh'>effh</span> <span class='op'>=</span> <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_eff'>eff</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span><span class='rbracket'>]</span>
|
515
517
|
<span class='id identifier rubyid_effh'>effh</span><span class='lbracket'>[</span><span class='id identifier rubyid_rehandles'>rehandles</span><span class='lbracket'>[</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_eff'>eff</span><span class='period'>.</span><span class='id identifier rubyid_args'>args</span><span class='rbracket'>]</span>
|
516
518
|
<span class='kw'>else</span>
|
517
|
-
<span class='const'>Fiber</span><span class='period'>.</span><span class='id identifier rubyid_yield'>yield</span> <span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Throws
|
519
|
+
<span class='const'>Fiber</span><span class='period'>.</span><span class='id identifier rubyid_yield'>yield</span> <span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Throws/Resend.html" title="Ruff::Throws::Resend (class)">Resend</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Throws/Resend.html#initialize-instance_method" title="Ruff::Throws::Resend#initialize (method)">new</a></span></span> <span class='id identifier rubyid_r'>r</span><span class='comma'>,</span> <span class='id identifier rubyid_rehandles'>rehandles</span><span class='lbracket'>[</span><span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_k'>k</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
518
520
|
<span class='kw'>end</span>
|
519
521
|
<span class='kw'>else</span>
|
520
522
|
<span class='id identifier rubyid_r'>r</span>
|
@@ -560,9 +562,9 @@ to go back to the handled computation.</p>
|
|
560
562
|
</div>
|
561
563
|
|
562
564
|
<div id="footer">
|
563
|
-
Generated on Wed
|
565
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
564
566
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
565
|
-
0.9.20 (ruby-2.6.
|
567
|
+
0.9.20 (ruby-2.6.4).
|
566
568
|
</div>
|
567
569
|
|
568
570
|
</div>
|
data/docs/Ruff/Throws.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Ruff::Throws
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -74,13 +74,16 @@
|
|
74
74
|
|
75
75
|
|
76
76
|
|
77
|
+
<dl>
|
78
|
+
<dt>Included in:</dt>
|
79
|
+
<dd><span class='object_link'><a href="Handler.html" title="Ruff::Handler (class)">Handler</a></span></dd>
|
80
|
+
</dl>
|
81
|
+
|
77
82
|
|
78
83
|
|
79
84
|
<dl>
|
80
85
|
<dt>Defined in:</dt>
|
81
|
-
<dd>lib/ruff/objects.rb
|
82
|
-
lib/ruff/objects.rb</span>
|
83
|
-
</dd>
|
86
|
+
<dd>lib/ruff/objects.rb</dd>
|
84
87
|
</dl>
|
85
88
|
|
86
89
|
</div>
|
@@ -107,9 +110,9 @@
|
|
107
110
|
</div>
|
108
111
|
|
109
112
|
<div id="footer">
|
110
|
-
Generated on Wed
|
113
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
111
114
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
112
|
-
0.9.20 (ruby-2.6.
|
115
|
+
0.9.20 (ruby-2.6.4).
|
113
116
|
</div>
|
114
117
|
|
115
118
|
</div>
|
data/docs/Ruff/Throws/Eff.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Ruff::Throws::Eff
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -243,12 +243,12 @@
|
|
243
243
|
<pre class="lines">
|
244
244
|
|
245
245
|
|
246
|
+
14
|
246
247
|
15
|
247
|
-
16
|
248
|
-
17</pre>
|
248
|
+
16</pre>
|
249
249
|
</td>
|
250
250
|
<td>
|
251
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line
|
251
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 14</span>
|
252
252
|
|
253
253
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='comma'>,</span> <span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
254
254
|
<span class='ivar'>@id</span> <span class='op'>=</span> <span class='id identifier rubyid_id'>id</span><span class='semicolon'>;</span> <span class='ivar'>@args</span> <span class='op'>=</span> <span class='id identifier rubyid_args'>args</span>
|
@@ -290,12 +290,12 @@
|
|
290
290
|
<pre class="lines">
|
291
291
|
|
292
292
|
|
293
|
+
11
|
293
294
|
12
|
294
|
-
13
|
295
|
-
14</pre>
|
295
|
+
13</pre>
|
296
296
|
</td>
|
297
297
|
<td>
|
298
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line
|
298
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 11</span>
|
299
299
|
|
300
300
|
<span class='kw'>def</span> <span class='id identifier rubyid_args'>args</span>
|
301
301
|
<span class='ivar'>@args</span>
|
@@ -332,12 +332,12 @@
|
|
332
332
|
<pre class="lines">
|
333
333
|
|
334
334
|
|
335
|
+
8
|
335
336
|
9
|
336
|
-
10
|
337
|
-
11</pre>
|
337
|
+
10</pre>
|
338
338
|
</td>
|
339
339
|
<td>
|
340
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line
|
340
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 8</span>
|
341
341
|
|
342
342
|
<span class='kw'>def</span> <span class='id identifier rubyid_id'>id</span>
|
343
343
|
<span class='ivar'>@id</span>
|
@@ -353,9 +353,9 @@
|
|
353
353
|
</div>
|
354
354
|
|
355
355
|
<div id="footer">
|
356
|
-
Generated on Wed
|
356
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
357
357
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
358
|
-
0.9.20 (ruby-2.6.
|
358
|
+
0.9.20 (ruby-2.6.4).
|
359
359
|
</div>
|
360
360
|
|
361
361
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Ruff::Throws::Resend
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -243,12 +243,12 @@
|
|
243
243
|
<pre class="lines">
|
244
244
|
|
245
245
|
|
246
|
-
|
247
|
-
|
248
|
-
|
246
|
+
30
|
247
|
+
31
|
248
|
+
32</pre>
|
249
249
|
</td>
|
250
250
|
<td>
|
251
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line
|
251
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 30</span>
|
252
252
|
|
253
253
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_eff'>eff</span><span class='comma'>,</span> <span class='id identifier rubyid_k'>k</span><span class='rparen'>)</span>
|
254
254
|
<span class='ivar'>@eff</span> <span class='op'>=</span> <span class='id identifier rubyid_eff'>eff</span><span class='semicolon'>;</span> <span class='ivar'>@k</span> <span class='op'>=</span> <span class='id identifier rubyid_k'>k</span>
|
@@ -290,12 +290,12 @@
|
|
290
290
|
<pre class="lines">
|
291
291
|
|
292
292
|
|
293
|
-
|
294
|
-
|
295
|
-
|
293
|
+
24
|
294
|
+
25
|
295
|
+
26</pre>
|
296
296
|
</td>
|
297
297
|
<td>
|
298
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line
|
298
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 24</span>
|
299
299
|
|
300
300
|
<span class='kw'>def</span> <span class='id identifier rubyid_eff'>eff</span>
|
301
301
|
<span class='ivar'>@eff</span>
|
@@ -332,12 +332,12 @@
|
|
332
332
|
<pre class="lines">
|
333
333
|
|
334
334
|
|
335
|
-
|
336
|
-
|
337
|
-
|
335
|
+
27
|
336
|
+
28
|
337
|
+
29</pre>
|
338
338
|
</td>
|
339
339
|
<td>
|
340
|
-
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line
|
340
|
+
<pre class="code"><span class="info file"># File 'lib/ruff/objects.rb', line 27</span>
|
341
341
|
|
342
342
|
<span class='kw'>def</span> <span class='id identifier rubyid_k'>k</span>
|
343
343
|
<span class='ivar'>@k</span>
|
@@ -353,9 +353,9 @@
|
|
353
353
|
</div>
|
354
354
|
|
355
355
|
<div id="footer">
|
356
|
-
Generated on Wed
|
356
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
357
357
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
358
|
-
0.9.20 (ruby-2.6.
|
358
|
+
0.9.20 (ruby-2.6.4).
|
359
359
|
</div>
|
360
360
|
|
361
361
|
</div>
|
data/docs/_index.html
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
|
-
Ruff 0.0.
|
7
|
+
Ruff 0.0.6 Documentation
|
8
8
|
|
9
9
|
</title>
|
10
10
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
<div class="clear"></div>
|
53
53
|
</div>
|
54
54
|
|
55
|
-
<div id="content"><h1 class="noborder title">Ruff 0.0.
|
55
|
+
<div id="content"><h1 class="noborder title">Ruff 0.0.6 Documentation</h1>
|
56
56
|
<div id="listing">
|
57
57
|
<h1 class="alphaindex">Alphabetic Index</h1>
|
58
58
|
|
@@ -156,9 +156,9 @@
|
|
156
156
|
</div>
|
157
157
|
|
158
158
|
<div id="footer">
|
159
|
-
Generated on Wed
|
159
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
160
160
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
161
|
-
0.9.20 (ruby-2.6.
|
161
|
+
0.9.20 (ruby-2.6.4).
|
162
162
|
</div>
|
163
163
|
|
164
164
|
</div>
|
data/docs/file.README.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -87,12 +87,20 @@
|
|
87
87
|
</span><span class='comment'># 9
|
88
88
|
</span><span class='comment'># logger: 6
|
89
89
|
</span></code></pre>
|
90
|
+
|
91
|
+
<h1>Documentation</h1>
|
92
|
+
|
93
|
+
<p>See <a href="https://nymphium.github.io/ruff/">here</a>.</p>
|
94
|
+
|
95
|
+
<h1>LICENSE</h1>
|
96
|
+
|
97
|
+
<p>MIT</p>
|
90
98
|
</div></div>
|
91
99
|
|
92
100
|
<div id="footer">
|
93
|
-
Generated on Wed
|
101
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
94
102
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
95
|
-
0.9.20 (ruby-2.6.
|
103
|
+
0.9.20 (ruby-2.6.4).
|
96
104
|
</div>
|
97
105
|
|
98
106
|
</div>
|
data/docs/frames.html
CHANGED
data/docs/index.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -87,12 +87,20 @@
|
|
87
87
|
</span><span class='comment'># 9
|
88
88
|
</span><span class='comment'># logger: 6
|
89
89
|
</span></code></pre>
|
90
|
+
|
91
|
+
<h1>Documentation</h1>
|
92
|
+
|
93
|
+
<p>See <a href="https://nymphium.github.io/ruff/">here</a>.</p>
|
94
|
+
|
95
|
+
<h1>LICENSE</h1>
|
96
|
+
|
97
|
+
<p>MIT</p>
|
90
98
|
</div></div>
|
91
99
|
|
92
100
|
<div id="footer">
|
93
|
-
Generated on Wed
|
101
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
94
102
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
95
|
-
0.9.20 (ruby-2.6.
|
103
|
+
0.9.20 (ruby-2.6.4).
|
96
104
|
</div>
|
97
105
|
|
98
106
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
— Ruff 0.0.
|
9
|
+
— Ruff 0.0.6 Documentation
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -100,9 +100,9 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on Wed
|
103
|
+
Generated on Wed Oct 2 22:42:03 2019 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
-
0.9.20 (ruby-2.6.
|
105
|
+
0.9.20 (ruby-2.6.4).
|
106
106
|
</div>
|
107
107
|
|
108
108
|
</div>
|
data/lib/ruff/effect.rb
CHANGED
@@ -1,25 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
attr_reader :id
|
1
|
+
# This class provides an effect instance.
|
2
|
+
class Ruff::Effect
|
3
|
+
# Each instance must be unique so they have unique id with UUID
|
4
|
+
attr_reader :id
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
# instaciates an effect setting `id`.
|
7
|
+
# @return [Effect<Arg, Ret>]
|
8
|
+
# @example
|
9
|
+
# Log = Effect.new #==> it _might_ be Effect<string, nil>
|
10
|
+
def initialize
|
11
|
+
@id = SecureRandom.uuid
|
12
|
+
@id.freeze
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
15
|
+
# sends an effect ID and its arguments to a nearmost handler.
|
16
|
+
# @param [Arg] a of the object `Effect<Arg, Ret>`
|
17
|
+
# @return [Ret] of the object `Effect<Arg, Ret>`
|
18
|
+
# @example
|
19
|
+
# Log.perform "hello"
|
20
|
+
def perform(*a)
|
21
|
+
return Fiber.yield Ruff::Throws::Eff.new(@id, a)
|
24
22
|
end
|
25
23
|
end
|
data/lib/ruff/handler.rb
CHANGED
@@ -1,106 +1,105 @@
|
|
1
|
-
|
1
|
+
class Ruff::Handler
|
2
|
+
include Ruff::Throws
|
2
3
|
# In algebraic effects, handler is an first-class object.
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
4
|
+
# makes a new handler, internally having fresh empty hash.
|
5
|
+
# This is a effect-handler store and when handliong it is looked up.
|
6
|
+
# @example
|
7
|
+
# handler = Handler.new
|
8
|
+
def initialize
|
9
|
+
@handlers = Hash.new
|
10
|
+
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
12
|
+
# sets effec handler `&prc` for `eff`
|
13
|
+
#
|
14
|
+
# @param [Effect<Arg, Ret>] eff
|
15
|
+
# the effect instance to be handled
|
16
|
+
# @param [Proc<Arg, Ret => A>] prc
|
17
|
+
# a handler to handle `eff`;
|
18
|
+
# First argument of `&prc` is *continuation*, proc object
|
19
|
+
# to go back to the handled computation.
|
20
|
+
# @return [Handler{Effect<Arg, Ret>, e}] itself updated with handling `Effect<Arg, Ret>`
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# handler.on(Log) {|k, msg|
|
24
|
+
# puts "Logger: #{msg}"
|
25
|
+
# k[]
|
26
|
+
# }
|
27
|
+
def on(eff, &prc)
|
28
|
+
@handlers[eff.id] = prc
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
self
|
31
|
+
end
|
32
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
|
-
|
33
|
+
# @param [Proc<(), T>] prc
|
34
|
+
# @return [T]
|
35
|
+
#
|
36
|
+
# handles the computation.
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# handler.run {
|
40
|
+
# Log.perform "hello"
|
41
|
+
# }
|
42
|
+
#
|
43
|
+
# @example `handler` can be layered.
|
44
|
+
# handler.run {
|
45
|
+
# Handler.new
|
46
|
+
# .on(Double){|k, v|
|
47
|
+
# k[v * v]
|
48
|
+
# }.run {
|
49
|
+
# v = Double.perform 3
|
50
|
+
# Log.perform 3
|
51
|
+
# }
|
52
|
+
# }
|
53
|
+
def run(&prc)
|
54
|
+
co = Fiber.new &prc
|
55
|
+
continue = nil
|
56
|
+
rehandles = nil
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
else
|
63
|
-
Fiber.yield (Throws::Resend.new r, continue)
|
64
|
-
end
|
65
|
-
elsif r.is_a? Throws::Resend
|
66
|
-
if effh = @handlers[r.eff.id]
|
67
|
-
effh[rehandles[r.k], *r.eff.args]
|
68
|
-
else
|
69
|
-
Fiber.yield (Throws::Resend.new r, rehandles[r.k])
|
70
|
-
end
|
58
|
+
handle = ->(r) {
|
59
|
+
if r.is_a? Eff
|
60
|
+
if effh = @handlers[r.id]
|
61
|
+
effh[continue, *r.args]
|
71
62
|
else
|
72
|
-
r
|
63
|
+
Fiber.yield (Resend.new r, continue)
|
73
64
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
@handlers[id] = h
|
65
|
+
elsif r.is_a? Resend
|
66
|
+
if effh = @handlers[r.eff.id]
|
67
|
+
effh[rehandles[r.k], *r.eff.args]
|
68
|
+
else
|
69
|
+
Fiber.yield (Resend.new r, rehandles[r.k])
|
80
70
|
end
|
71
|
+
else
|
72
|
+
r
|
73
|
+
end
|
74
|
+
}
|
81
75
|
|
82
|
-
|
83
|
-
|
84
|
-
|
76
|
+
rehandles = ->(k){
|
77
|
+
newh = self.class.new
|
78
|
+
def newh.add_handler id, h
|
79
|
+
@handlers[id] = h
|
80
|
+
end
|
85
81
|
|
86
|
-
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
->(*args) {
|
91
|
-
continue[
|
92
|
-
newh.run {
|
93
|
-
k[*args]
|
94
|
-
}
|
95
|
-
]
|
96
|
-
}
|
82
|
+
@handlers.each{|id, h|
|
83
|
+
newh.add_handler id, h
|
97
84
|
}
|
98
85
|
|
99
|
-
|
100
|
-
|
86
|
+
class << newh
|
87
|
+
undef add_handler
|
88
|
+
end
|
89
|
+
|
90
|
+
->(*args) {
|
91
|
+
continue[
|
92
|
+
newh.run {
|
93
|
+
k[*args]
|
94
|
+
}
|
95
|
+
]
|
101
96
|
}
|
97
|
+
}
|
98
|
+
|
99
|
+
continue = ->(*arg) {
|
100
|
+
handle[co.resume(*arg)]
|
101
|
+
}
|
102
102
|
|
103
|
-
|
104
|
-
end
|
103
|
+
continue[nil]
|
105
104
|
end
|
106
105
|
end
|
data/lib/ruff/objects.rb
CHANGED
@@ -1,39 +1,33 @@
|
|
1
|
-
module Ruff
|
2
|
-
module Throws
|
3
|
-
# `Eff` is internal object.
|
4
|
-
#
|
5
|
-
# They make effects encapsulate with ID and arguments to be sent to the handler.
|
6
|
-
class Eff
|
1
|
+
module Ruff::Throws end
|
7
2
|
|
8
|
-
|
9
|
-
|
3
|
+
# `Eff` is internal object.
|
4
|
+
#
|
5
|
+
# They make effects encapsulate with ID and arguments to be sent to the handler.
|
6
|
+
class Ruff::Throws::Eff
|
7
|
+
# makes the object unique.
|
8
|
+
attr_reader :id
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
# passes to a handler which can catch the effect.
|
11
|
+
attr_reader :args
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
13
|
+
# creates a new object with `id` and `args`.
|
14
|
+
def initialize(id, args)
|
15
|
+
@id = id; @args = args
|
19
16
|
end
|
17
|
+
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
#is abstracted effect (such as `Eff` or (re)thrown `Resend`).
|
28
|
-
attr_reader :eff
|
19
|
+
# `Resend` is internal object like `Eff`.
|
20
|
+
#
|
21
|
+
# It is used when an effect is unable to be handled and should be thrown to the outer handler.
|
22
|
+
class Ruff::Throws::Resend
|
23
|
+
#is abstracted effect (such as `Eff` or (re)thrown `Resend`).
|
24
|
+
attr_reader :eff
|
29
25
|
|
30
|
-
|
31
|
-
|
26
|
+
# is a continuation of `eff` thrown context.
|
27
|
+
attr_reader :k
|
32
28
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
29
|
+
# creates a new object with `eff` and `k`.
|
30
|
+
def initialize(eff, k)
|
31
|
+
@eff = eff; @k = k
|
38
32
|
end
|
39
33
|
end
|
data/lib/ruff/version.rb
CHANGED
data/version.h
CHANGED
@@ -1 +1 @@
|
|
1
|
-
#define RUFF_VERSION "0.0.
|
1
|
+
#define RUFF_VERSION "0.0.6"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nymphium
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
|
-
rubygems_version: 3.0.
|
102
|
+
rubygems_version: 3.0.6
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: ONE-SHOT Algebraic Effects for Ruby!
|