mangrove 0.4.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/Rakefile +14 -1
- data/docs/Mangrove/ControlFlow/ControlSignal.html +223 -0
- data/docs/Mangrove/ControlFlow/Handler/ClassMethods.html +563 -0
- data/docs/Mangrove/ControlFlow/Handler.html +139 -0
- data/docs/Mangrove/ControlFlow/Rewriter.html +331 -0
- data/docs/Mangrove/ControlFlow.html +254 -0
- data/docs/Mangrove/Option/ControlSignal.html +434 -0
- data/docs/Mangrove/Option/None.html +978 -0
- data/docs/Mangrove/Option/Some.html +1108 -0
- data/docs/Mangrove/Option.html +942 -0
- data/docs/Mangrove/Result/ControlSignal.html +434 -0
- data/docs/Mangrove/Result/Err.html +953 -0
- data/docs/Mangrove/Result/Ok.html +927 -0
- data/docs/Mangrove/Result.html +889 -0
- data/docs/Mangrove.html +144 -0
- data/docs/_index.html +257 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +176 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +176 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +619 -0
- data/docs/top-level-namespace.html +110 -0
- data/hooks/pre-push +2 -0
- data/lib/mangrove/option.rb +13 -0
- data/lib/mangrove/result.rb +42 -23
- data/lib/mangrove/version.rb +1 -1
- metadata +31 -2
@@ -0,0 +1,110 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.34
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">Top Level Namespace</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Top Level Namespace
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<h2>Defined Under Namespace</h2>
|
82
|
+
<p class="children">
|
83
|
+
|
84
|
+
|
85
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Mangrove.html" title="Mangrove (module)">Mangrove</a></span>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
</p>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div id="footer">
|
103
|
+
Generated on Fri Sep 1 17:32:57 2023 by
|
104
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
+
0.9.34 (ruby-3.2.2).
|
106
|
+
</div>
|
107
|
+
|
108
|
+
</div>
|
109
|
+
</body>
|
110
|
+
</html>
|
data/hooks/pre-push
ADDED
data/lib/mangrove/option.rb
CHANGED
@@ -82,6 +82,11 @@ module Mangrove
|
|
82
82
|
self
|
83
83
|
end
|
84
84
|
|
85
|
+
sig { override.type_parameters(:ErrType).params(_err: T.type_parameter(:ErrType)).returns(Mangrove::Result[InnerType, T.type_parameter(:ErrType)]) }
|
86
|
+
def transpose(_err)
|
87
|
+
Result::Ok.new(@inner)
|
88
|
+
end
|
89
|
+
|
85
90
|
private
|
86
91
|
|
87
92
|
sig { returns(InnerType) }
|
@@ -141,6 +146,11 @@ module Mangrove
|
|
141
146
|
def map_none(&block)
|
142
147
|
block.call
|
143
148
|
end
|
149
|
+
|
150
|
+
sig { override.type_parameters(:ErrType).params(err: T.type_parameter(:ErrType)).returns(Mangrove::Result[InnerType, T.type_parameter(:ErrType)]) }
|
151
|
+
def transpose(err)
|
152
|
+
Result::Err.new(err)
|
153
|
+
end
|
144
154
|
end
|
145
155
|
|
146
156
|
sig { abstract.params(other: BasicObject).returns(T::Boolean) }
|
@@ -166,5 +176,8 @@ module Mangrove
|
|
166
176
|
|
167
177
|
sig { abstract.params(block: T.proc.returns(Option[InnerType])).returns(Option[InnerType]) }
|
168
178
|
def map_none(&block); end
|
179
|
+
|
180
|
+
sig { abstract.type_parameters(:ErrType).params(err: T.type_parameter(:ErrType)).returns(Mangrove::Result[InnerType, T.type_parameter(:ErrType)]) }
|
181
|
+
def transpose(err); end
|
169
182
|
end
|
170
183
|
end
|
data/lib/mangrove/result.rb
CHANGED
@@ -18,7 +18,48 @@ module Mangrove
|
|
18
18
|
OkType = type_member
|
19
19
|
ErrType = type_member
|
20
20
|
|
21
|
-
|
21
|
+
sig { abstract.params(other: BasicObject).returns(T::Boolean) }
|
22
|
+
def ==(other); end
|
23
|
+
|
24
|
+
sig { abstract.returns(T::Boolean) }
|
25
|
+
def ok?; end
|
26
|
+
|
27
|
+
sig { abstract.returns(T::Boolean) }
|
28
|
+
def err?; end
|
29
|
+
|
30
|
+
sig { abstract.returns(OkType) }
|
31
|
+
def unwrap!; end
|
32
|
+
|
33
|
+
sig { abstract.params(message: String).returns(OkType) }
|
34
|
+
def expect!(message); end
|
35
|
+
|
36
|
+
sig { abstract.params(block: T.proc.params(this: OkType).returns(Result[OkType, ErrType])).returns(Result[OkType, ErrType]) }
|
37
|
+
def map_ok(&block); end
|
38
|
+
|
39
|
+
sig { abstract.params(block: T.proc.params(this: ErrType).returns(Result[OkType, ErrType])).returns(Result[OkType, ErrType]) }
|
40
|
+
def map_err(&block); end
|
41
|
+
|
42
|
+
class << self
|
43
|
+
extend T::Sig
|
44
|
+
extend T::Generic
|
45
|
+
|
46
|
+
OkType = type_member
|
47
|
+
ErrType = type_member
|
48
|
+
|
49
|
+
sig { params(results: T::Enumerable[Mangrove::Result[OkType, ErrType]]).returns(Result[OkType, ErrType]) }
|
50
|
+
def from_results(results)
|
51
|
+
errs = results.filter(&:err?)
|
52
|
+
|
53
|
+
if errs.empty?
|
54
|
+
# This is safe as errs is empty.
|
55
|
+
Result::Ok.new(results.map { |r| T.cast(r, Result::Ok[OkType, ErrType]).ok_inner })
|
56
|
+
else
|
57
|
+
# This is safe as errs is results where err? is true
|
58
|
+
Result::Err.new(errs.map { |r| T.cast(r, Result::Err[OkType, ErrType]).err_inner })
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
22
63
|
class Ok
|
23
64
|
extend T::Sig
|
24
65
|
extend T::Generic
|
@@ -78,7 +119,6 @@ module Mangrove
|
|
78
119
|
end
|
79
120
|
end
|
80
121
|
|
81
|
-
# Mangrove::Result::Err
|
82
122
|
class Err
|
83
123
|
extend T::Sig
|
84
124
|
extend T::Generic
|
@@ -137,26 +177,5 @@ module Mangrove
|
|
137
177
|
block.call(@inner)
|
138
178
|
end
|
139
179
|
end
|
140
|
-
|
141
|
-
sig { abstract.params(other: BasicObject).returns(T::Boolean) }
|
142
|
-
def ==(other); end
|
143
|
-
|
144
|
-
sig { abstract.returns(T::Boolean) }
|
145
|
-
def ok?; end
|
146
|
-
|
147
|
-
sig { abstract.returns(T::Boolean) }
|
148
|
-
def err?; end
|
149
|
-
|
150
|
-
sig { abstract.returns(OkType) }
|
151
|
-
def unwrap!; end
|
152
|
-
|
153
|
-
sig { abstract.params(message: String).returns(OkType) }
|
154
|
-
def expect!(message); end
|
155
|
-
|
156
|
-
sig { abstract.params(block: T.proc.params(this: OkType).returns(Result[OkType, ErrType])).returns(Result[OkType, ErrType]) }
|
157
|
-
def map_ok(&block); end
|
158
|
-
|
159
|
-
sig { abstract.params(block: T.proc.params(this: ErrType).returns(Result[OkType, ErrType])).returns(Result[OkType, ErrType]) }
|
160
|
-
def map_err(&block); end
|
161
180
|
end
|
162
181
|
end
|
data/lib/mangrove/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mangrove
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuma Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sorbet-runtime
|
@@ -77,6 +77,35 @@ files:
|
|
77
77
|
- LICENSE
|
78
78
|
- README.md
|
79
79
|
- Rakefile
|
80
|
+
- docs/Mangrove.html
|
81
|
+
- docs/Mangrove/ControlFlow.html
|
82
|
+
- docs/Mangrove/ControlFlow/ControlSignal.html
|
83
|
+
- docs/Mangrove/ControlFlow/Handler.html
|
84
|
+
- docs/Mangrove/ControlFlow/Handler/ClassMethods.html
|
85
|
+
- docs/Mangrove/ControlFlow/Rewriter.html
|
86
|
+
- docs/Mangrove/Option.html
|
87
|
+
- docs/Mangrove/Option/ControlSignal.html
|
88
|
+
- docs/Mangrove/Option/None.html
|
89
|
+
- docs/Mangrove/Option/Some.html
|
90
|
+
- docs/Mangrove/Result.html
|
91
|
+
- docs/Mangrove/Result/ControlSignal.html
|
92
|
+
- docs/Mangrove/Result/Err.html
|
93
|
+
- docs/Mangrove/Result/Ok.html
|
94
|
+
- docs/_index.html
|
95
|
+
- docs/class_list.html
|
96
|
+
- docs/css/common.css
|
97
|
+
- docs/css/full_list.css
|
98
|
+
- docs/css/style.css
|
99
|
+
- docs/file.README.html
|
100
|
+
- docs/file_list.html
|
101
|
+
- docs/frames.html
|
102
|
+
- docs/index.html
|
103
|
+
- docs/js/app.js
|
104
|
+
- docs/js/full_list.js
|
105
|
+
- docs/js/jquery.js
|
106
|
+
- docs/method_list.html
|
107
|
+
- docs/top-level-namespace.html
|
108
|
+
- hooks/pre-push
|
80
109
|
- lib/mangrove.rb
|
81
110
|
- lib/mangrove/control_flow.rb
|
82
111
|
- lib/mangrove/control_flow/control_signal.rb
|