fear 2.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +105 -0
- data/.simplecov +2 -2
- data/.standard.yml +1 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +14 -2
- data/Gemfile.lock +84 -78
- data/LICENSE.txt +1 -1
- data/README.md +18 -70
- data/Rakefile +55 -142
- data/benchmarks/dry_do_vs_fear_for.txt +7 -6
- data/benchmarks/dry_some_fmap_vs_fear_some_map.txt +7 -6
- data/benchmarks/factorial.txt +7 -9
- data/benchmarks/fear_gaurd_and1_vs_new.txt +7 -6
- data/benchmarks/fear_gaurd_and2_vs_and.txt +8 -7
- data/benchmarks/fear_gaurd_and3_vs_and_and.txt +7 -6
- data/benchmarks/fear_pattern_matching_construction_vs_execution.txt +7 -6
- data/benchmarks/pattern_matching_dry_vs_qo_vs_fear_try.txt +8 -10
- data/examples/pattern_extracting.rb +2 -2
- data/examples/pattern_matching_number_in_words.rb +12 -12
- data/fear.gemspec +5 -21
- data/lib/fear/either/left_projection.rb +237 -0
- data/lib/fear/either/pattern_match.rb +49 -0
- data/lib/fear/either.rb +21 -12
- data/lib/fear/either_api.rb +2 -4
- data/lib/fear/empty_partial_function.rb +3 -3
- data/lib/fear/failure/pattern_match.rb +14 -0
- data/lib/fear/failure.rb +5 -5
- data/lib/fear/for.rb +1 -1
- data/lib/fear/for_api.rb +1 -3
- data/lib/fear/future.rb +6 -6
- data/lib/fear/future_api.rb +0 -5
- data/lib/fear/left/pattern_match.rb +15 -0
- data/lib/fear/left.rb +4 -4
- data/lib/fear/none.rb +0 -87
- data/lib/fear/none_class/pattern_match.rb +16 -0
- data/lib/fear/none_class.rb +85 -0
- data/lib/fear/option/pattern_match.rb +47 -0
- data/lib/fear/option.rb +2 -6
- data/lib/fear/option_api.rb +1 -3
- data/lib/fear/partial_function/and_then.rb +2 -2
- data/lib/fear/partial_function/combined.rb +3 -3
- data/lib/fear/partial_function/empty.rb +3 -5
- data/lib/fear/partial_function/guard.rb +0 -4
- data/lib/fear/partial_function/or_else.rb +2 -4
- data/lib/fear/partial_function.rb +0 -9
- data/lib/fear/partial_function_class.rb +2 -2
- data/lib/fear/pattern_match.rb +5 -4
- data/lib/fear/pattern_matching_api.rb +1 -4
- data/lib/fear/right/pattern_match.rb +15 -0
- data/lib/fear/right.rb +4 -4
- data/lib/fear/right_biased.rb +2 -0
- data/lib/fear/some/pattern_match.rb +15 -0
- data/lib/fear/some.rb +3 -3
- data/lib/fear/success/pattern_match.rb +16 -0
- data/lib/fear/success.rb +5 -5
- data/lib/fear/try/pattern_match.rb +29 -0
- data/lib/fear/try.rb +3 -7
- data/lib/fear/try_api.rb +1 -3
- data/lib/fear/utils.rb +1 -1
- data/lib/fear/version.rb +1 -1
- data/lib/fear.rb +3 -14
- data/spec/fear/awaitable_spec.rb +0 -2
- data/spec/fear/either/left_projection_spec.rb +289 -0
- data/spec/fear/{either_pattern_match_spec.rb → either/pattern_match_spec.rb} +7 -7
- data/spec/fear/either_spec.rb +1 -1
- data/spec/fear/left_spec.rb +1 -1
- data/spec/fear/{option_pattern_match_spec.rb → option/pattern_match_spec.rb} +6 -6
- data/spec/fear/option_spec.rb +2 -2
- data/spec/fear/partial_function/any_spec.rb +3 -3
- data/spec/fear/partial_function/empty_spec.rb +2 -2
- data/spec/fear/partial_function_and_then_spec.rb +5 -5
- data/spec/fear/partial_function_composition_spec.rb +6 -6
- data/spec/fear/partial_function_or_else_spec.rb +13 -13
- data/spec/fear/partial_function_spec.rb +7 -7
- data/spec/fear/pattern_match_spec.rb +5 -5
- data/spec/fear/right_spec.rb +1 -1
- data/spec/fear/{try_pattern_match_spec.rb → try/try_pattern_match_spec.rb} +7 -7
- data/spec/fear/try_api_spec.rb +2 -2
- data/spec/fear/utils_spec.rb +3 -3
- data/spec/support/.keep +0 -0
- metadata +27 -296
- data/.github/workflows/rubocop.yml +0 -39
- data/.github/workflows/spec.yml +0 -43
- data/.rubocop.yml +0 -7
- data/benchmarks/fear_pattern_extracting_with_vs_without_cache.txt +0 -11
- data/benchmarks/pattern_matching_qo_vs_fear_pattern_extraction.txt +0 -11
- data/benchmarks/pattern_matching_qo_vs_fear_try_execution.txt +0 -11
- data/lib/dry/types/fear/option.rb +0 -125
- data/lib/dry/types/fear.rb +0 -8
- data/lib/fear/either_pattern_match.rb +0 -52
- data/lib/fear/failure_pattern_match.rb +0 -12
- data/lib/fear/left_pattern_match.rb +0 -11
- data/lib/fear/none_pattern_match.rb +0 -14
- data/lib/fear/option_pattern_match.rb +0 -50
- data/lib/fear/right_pattern_match.rb +0 -13
- data/lib/fear/some_pattern_match.rb +0 -13
- data/lib/fear/struct.rb +0 -237
- data/lib/fear/success_pattern_match.rb +0 -14
- data/lib/fear/try_pattern_match.rb +0 -32
- data/spec/dry/types/fear/option/constrained_spec.rb +0 -22
- data/spec/dry/types/fear/option/core_spec.rb +0 -77
- data/spec/dry/types/fear/option/default_spec.rb +0 -21
- data/spec/dry/types/fear/option/hash_spec.rb +0 -58
- data/spec/dry/types/fear/option/option_spec.rb +0 -97
- data/spec/struct_pattern_matching_spec.rb +0 -36
- data/spec/struct_spec.rb +0 -194
- data/spec/support/dry_types.rb +0 -6
data/spec/fear/right_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
RSpec.describe Fear::
|
3
|
+
RSpec.describe Fear::Try::PatternMatch do
|
4
4
|
context "Success" do
|
5
5
|
let(:matcher) do
|
6
6
|
described_class.new do |m|
|
@@ -10,10 +10,10 @@ RSpec.describe Fear::TryPatternMatch do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it do
|
13
|
-
expect(matcher.(Fear.success(4))).to eq("4 is even")
|
14
|
-
expect(matcher.(Fear.success(3))).to eq("3 is odd")
|
13
|
+
expect(matcher.call(Fear.success(4))).to eq("4 is even")
|
14
|
+
expect(matcher.call(Fear.success(3))).to eq("3 is odd")
|
15
15
|
expect do
|
16
|
-
matcher.(Fear.failure(RuntimeError.new))
|
16
|
+
matcher.call(Fear.failure(RuntimeError.new))
|
17
17
|
end.to raise_error(Fear::MatchError)
|
18
18
|
end
|
19
19
|
end
|
@@ -27,10 +27,10 @@ RSpec.describe Fear::TryPatternMatch do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it do
|
30
|
-
expect(matcher.(Fear.failure(RuntimeError.new))).to eq("RuntimeError is first")
|
31
|
-
expect(matcher.(Fear.failure(StandardError.new))).to eq("StandardError is second")
|
30
|
+
expect(matcher.call(Fear.failure(RuntimeError.new))).to eq("RuntimeError is first")
|
31
|
+
expect(matcher.call(Fear.failure(StandardError.new))).to eq("StandardError is second")
|
32
32
|
expect do
|
33
|
-
matcher.(Fear.success(44))
|
33
|
+
matcher.call(Fear.success(44))
|
34
34
|
end.to raise_error(Fear::MatchError)
|
35
35
|
end
|
36
36
|
end
|
data/spec/fear/try_api_spec.rb
CHANGED
@@ -15,9 +15,9 @@ RSpec.describe Fear::TryApi do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when low level error happened" do
|
18
|
-
subject(:try) { Fear.try { raise
|
18
|
+
subject(:try) { Fear.try { raise NoMemoryError } }
|
19
19
|
|
20
|
-
it { expect { try }.to raise_error(
|
20
|
+
it { expect { try }.to raise_error(NoMemoryError) }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/spec/fear/utils_spec.rb
CHANGED
@@ -24,7 +24,7 @@ RSpec.describe Fear::Utils do
|
|
24
24
|
it "fails with argument error" do
|
25
25
|
is_expected.to raise_error(
|
26
26
|
ArgumentError,
|
27
|
-
"#the_method accepts either one argument or block"
|
27
|
+
"#the_method accepts either one argument or block"
|
28
28
|
)
|
29
29
|
end
|
30
30
|
end
|
@@ -35,7 +35,7 @@ RSpec.describe Fear::Utils do
|
|
35
35
|
it "fails with argument error" do
|
36
36
|
is_expected.to raise_error(
|
37
37
|
ArgumentError,
|
38
|
-
"#the_method accepts either one argument or block"
|
38
|
+
"#the_method accepts either one argument or block"
|
39
39
|
)
|
40
40
|
end
|
41
41
|
end
|
@@ -54,7 +54,7 @@ RSpec.describe Fear::Utils do
|
|
54
54
|
it "raises TypeError" do
|
55
55
|
is_expected.to raise_error(
|
56
56
|
TypeError,
|
57
|
-
"expected `24` to be of String class"
|
57
|
+
"expected `24` to be of String class"
|
58
58
|
)
|
59
59
|
end
|
60
60
|
end
|
data/spec/support/.keep
ADDED
File without changes
|
metadata
CHANGED
@@ -1,233 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fear
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Tëma Bolshakov
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
13
|
+
name: zeitwerk
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '0'
|
20
|
-
type: :
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: concurrent-ruby
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: dry-matcher
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: dry-monads
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: qo
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rake
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '13.0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '13.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '3.1'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '3.1'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-rspec
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - '='
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 1.34.0
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - '='
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 1.34.0
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rubocop
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - '='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 1.32.0
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - '='
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 1.32.0
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: ruby_coding_standard
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: yard
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: dry-types
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: fear-rspec
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0'
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '0'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: simplecov
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
|
-
- !ruby/object:Gem::Dependency
|
224
|
-
name: simplecov-lcov
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - ">="
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
type: :development
|
19
|
+
type: :runtime
|
231
20
|
prerelease: false
|
232
21
|
version_requirements: !ruby/object:Gem::Requirement
|
233
22
|
requirements:
|
@@ -236,18 +25,17 @@ dependencies:
|
|
236
25
|
version: '0'
|
237
26
|
description: Ruby port of some Scala's monads.
|
238
27
|
email:
|
239
|
-
-
|
28
|
+
- tema@bolshakov.dev
|
240
29
|
executables: []
|
241
30
|
extensions: []
|
242
31
|
extra_rdoc_files: []
|
243
32
|
files:
|
244
33
|
- ".github/dependabot.yml"
|
245
|
-
- ".github/workflows/
|
246
|
-
- ".github/workflows/spec.yml"
|
34
|
+
- ".github/workflows/ci.yml"
|
247
35
|
- ".gitignore"
|
248
36
|
- ".rspec"
|
249
|
-
- ".rubocop.yml"
|
250
37
|
- ".simplecov"
|
38
|
+
- ".standard.yml"
|
251
39
|
- ".yardopts"
|
252
40
|
- CHANGELOG.md
|
253
41
|
- Gemfile
|
@@ -262,37 +50,34 @@ files:
|
|
262
50
|
- benchmarks/fear_gaurd_and1_vs_new.txt
|
263
51
|
- benchmarks/fear_gaurd_and2_vs_and.txt
|
264
52
|
- benchmarks/fear_gaurd_and3_vs_and_and.txt
|
265
|
-
- benchmarks/fear_pattern_extracting_with_vs_without_cache.txt
|
266
53
|
- benchmarks/fear_pattern_matching_construction_vs_execution.txt
|
267
54
|
- benchmarks/pattern_matching_dry_vs_qo_vs_fear_try.txt
|
268
|
-
- benchmarks/pattern_matching_qo_vs_fear_pattern_extraction.txt
|
269
|
-
- benchmarks/pattern_matching_qo_vs_fear_try_execution.txt
|
270
55
|
- examples/pattern_extracting.rb
|
271
56
|
- examples/pattern_matching_binary_tree_set.rb
|
272
57
|
- examples/pattern_matching_number_in_words.rb
|
273
58
|
- fear.gemspec
|
274
|
-
- lib/dry/types/fear.rb
|
275
|
-
- lib/dry/types/fear/option.rb
|
276
59
|
- lib/fear.rb
|
277
60
|
- lib/fear/await.rb
|
278
61
|
- lib/fear/awaitable.rb
|
279
62
|
- lib/fear/either.rb
|
63
|
+
- lib/fear/either/left_projection.rb
|
64
|
+
- lib/fear/either/pattern_match.rb
|
280
65
|
- lib/fear/either_api.rb
|
281
|
-
- lib/fear/either_pattern_match.rb
|
282
66
|
- lib/fear/empty_partial_function.rb
|
283
67
|
- lib/fear/failure.rb
|
284
|
-
- lib/fear/
|
68
|
+
- lib/fear/failure/pattern_match.rb
|
285
69
|
- lib/fear/for.rb
|
286
70
|
- lib/fear/for_api.rb
|
287
71
|
- lib/fear/future.rb
|
288
72
|
- lib/fear/future_api.rb
|
289
73
|
- lib/fear/left.rb
|
290
|
-
- lib/fear/
|
74
|
+
- lib/fear/left/pattern_match.rb
|
291
75
|
- lib/fear/none.rb
|
292
|
-
- lib/fear/
|
76
|
+
- lib/fear/none_class.rb
|
77
|
+
- lib/fear/none_class/pattern_match.rb
|
293
78
|
- lib/fear/option.rb
|
79
|
+
- lib/fear/option/pattern_match.rb
|
294
80
|
- lib/fear/option_api.rb
|
295
|
-
- lib/fear/option_pattern_match.rb
|
296
81
|
- lib/fear/partial_function.rb
|
297
82
|
- lib/fear/partial_function/and_then.rb
|
298
83
|
- lib/fear/partial_function/any.rb
|
@@ -309,28 +94,23 @@ files:
|
|
309
94
|
- lib/fear/pattern_matching_api.rb
|
310
95
|
- lib/fear/promise.rb
|
311
96
|
- lib/fear/right.rb
|
97
|
+
- lib/fear/right/pattern_match.rb
|
312
98
|
- lib/fear/right_biased.rb
|
313
|
-
- lib/fear/right_pattern_match.rb
|
314
99
|
- lib/fear/some.rb
|
315
|
-
- lib/fear/
|
316
|
-
- lib/fear/struct.rb
|
100
|
+
- lib/fear/some/pattern_match.rb
|
317
101
|
- lib/fear/success.rb
|
318
|
-
- lib/fear/
|
102
|
+
- lib/fear/success/pattern_match.rb
|
319
103
|
- lib/fear/try.rb
|
104
|
+
- lib/fear/try/pattern_match.rb
|
320
105
|
- lib/fear/try_api.rb
|
321
|
-
- lib/fear/try_pattern_match.rb
|
322
106
|
- lib/fear/unit.rb
|
323
107
|
- lib/fear/utils.rb
|
324
108
|
- lib/fear/version.rb
|
325
|
-
- spec/dry/types/fear/option/constrained_spec.rb
|
326
|
-
- spec/dry/types/fear/option/core_spec.rb
|
327
|
-
- spec/dry/types/fear/option/default_spec.rb
|
328
|
-
- spec/dry/types/fear/option/hash_spec.rb
|
329
|
-
- spec/dry/types/fear/option/option_spec.rb
|
330
109
|
- spec/fear/awaitable_spec.rb
|
331
110
|
- spec/fear/done_spec.rb
|
111
|
+
- spec/fear/either/left_projection_spec.rb
|
332
112
|
- spec/fear/either/mixin_spec.rb
|
333
|
-
- spec/fear/
|
113
|
+
- spec/fear/either/pattern_match_spec.rb
|
334
114
|
- spec/fear/either_pattern_matching_spec.rb
|
335
115
|
- spec/fear/either_spec.rb
|
336
116
|
- spec/fear/failure_spec.rb
|
@@ -341,7 +121,7 @@ files:
|
|
341
121
|
- spec/fear/left_spec.rb
|
342
122
|
- spec/fear/none_spec.rb
|
343
123
|
- spec/fear/option/mixin_spec.rb
|
344
|
-
- spec/fear/
|
124
|
+
- spec/fear/option/pattern_match_spec.rb
|
345
125
|
- spec/fear/option_pattern_matching_spec.rb
|
346
126
|
- spec/fear/option_spec.rb
|
347
127
|
- spec/fear/partial_function/any_spec.rb
|
@@ -359,19 +139,16 @@ files:
|
|
359
139
|
- spec/fear/some_spec.rb
|
360
140
|
- spec/fear/success_spec.rb
|
361
141
|
- spec/fear/try/mixin_spec.rb
|
142
|
+
- spec/fear/try/try_pattern_match_spec.rb
|
362
143
|
- spec/fear/try_api_spec.rb
|
363
|
-
- spec/fear/try_pattern_match_spec.rb
|
364
144
|
- spec/fear/try_pattern_matching_spec.rb
|
365
145
|
- spec/fear/utils_spec.rb
|
366
146
|
- spec/spec_helper.rb
|
367
|
-
- spec/
|
368
|
-
- spec/struct_spec.rb
|
369
|
-
- spec/support/dry_types.rb
|
147
|
+
- spec/support/.keep
|
370
148
|
homepage: https://github.com/bolshakov/fear
|
371
149
|
licenses:
|
372
150
|
- MIT
|
373
151
|
metadata: {}
|
374
|
-
post_install_message:
|
375
152
|
rdoc_options: []
|
376
153
|
require_paths:
|
377
154
|
- lib
|
@@ -379,60 +156,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
379
156
|
requirements:
|
380
157
|
- - ">="
|
381
158
|
- !ruby/object:Gem::Version
|
382
|
-
version: 2
|
159
|
+
version: '3.2'
|
383
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
384
161
|
requirements:
|
385
162
|
- - ">="
|
386
163
|
- !ruby/object:Gem::Version
|
387
164
|
version: '0'
|
388
165
|
requirements: []
|
389
|
-
rubygems_version: 3.
|
390
|
-
signing_key:
|
166
|
+
rubygems_version: 3.6.9
|
391
167
|
specification_version: 4
|
392
168
|
summary: "%q{Ruby port of some Scala's monads.}"
|
393
|
-
test_files:
|
394
|
-
- spec/dry/types/fear/option/constrained_spec.rb
|
395
|
-
- spec/dry/types/fear/option/core_spec.rb
|
396
|
-
- spec/dry/types/fear/option/default_spec.rb
|
397
|
-
- spec/dry/types/fear/option/hash_spec.rb
|
398
|
-
- spec/dry/types/fear/option/option_spec.rb
|
399
|
-
- spec/fear/awaitable_spec.rb
|
400
|
-
- spec/fear/done_spec.rb
|
401
|
-
- spec/fear/either/mixin_spec.rb
|
402
|
-
- spec/fear/either_pattern_match_spec.rb
|
403
|
-
- spec/fear/either_pattern_matching_spec.rb
|
404
|
-
- spec/fear/either_spec.rb
|
405
|
-
- spec/fear/failure_spec.rb
|
406
|
-
- spec/fear/for/mixin_spec.rb
|
407
|
-
- spec/fear/for_spec.rb
|
408
|
-
- spec/fear/future_spec.rb
|
409
|
-
- spec/fear/guard_spec.rb
|
410
|
-
- spec/fear/left_spec.rb
|
411
|
-
- spec/fear/none_spec.rb
|
412
|
-
- spec/fear/option/mixin_spec.rb
|
413
|
-
- spec/fear/option_pattern_match_spec.rb
|
414
|
-
- spec/fear/option_pattern_matching_spec.rb
|
415
|
-
- spec/fear/option_spec.rb
|
416
|
-
- spec/fear/partial_function/any_spec.rb
|
417
|
-
- spec/fear/partial_function/empty_spec.rb
|
418
|
-
- spec/fear/partial_function_and_then_spec.rb
|
419
|
-
- spec/fear/partial_function_composition_spec.rb
|
420
|
-
- spec/fear/partial_function_or_else_spec.rb
|
421
|
-
- spec/fear/partial_function_spec.rb
|
422
|
-
- spec/fear/pattern_match_spec.rb
|
423
|
-
- spec/fear/pattern_matching_api_spec.rb
|
424
|
-
- spec/fear/promise_spec.rb
|
425
|
-
- spec/fear/right_biased/left.rb
|
426
|
-
- spec/fear/right_biased/right.rb
|
427
|
-
- spec/fear/right_spec.rb
|
428
|
-
- spec/fear/some_spec.rb
|
429
|
-
- spec/fear/success_spec.rb
|
430
|
-
- spec/fear/try/mixin_spec.rb
|
431
|
-
- spec/fear/try_api_spec.rb
|
432
|
-
- spec/fear/try_pattern_match_spec.rb
|
433
|
-
- spec/fear/try_pattern_matching_spec.rb
|
434
|
-
- spec/fear/utils_spec.rb
|
435
|
-
- spec/spec_helper.rb
|
436
|
-
- spec/struct_pattern_matching_spec.rb
|
437
|
-
- spec/struct_spec.rb
|
438
|
-
- spec/support/dry_types.rb
|
169
|
+
test_files: []
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# pulled from repo
|
2
|
-
name: "Rubocop"
|
3
|
-
|
4
|
-
on: pull_request
|
5
|
-
|
6
|
-
jobs:
|
7
|
-
rubocop:
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
strategy:
|
10
|
-
fail-fast: false
|
11
|
-
|
12
|
-
steps:
|
13
|
-
- name: Checkout repository
|
14
|
-
uses: actions/checkout@v2
|
15
|
-
|
16
|
-
# If running on a self-hosted runner, check it meets the requirements
|
17
|
-
# listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners
|
18
|
-
- name: Set up Ruby
|
19
|
-
uses: ruby/setup-ruby@v1
|
20
|
-
with:
|
21
|
-
ruby-version: 3.1
|
22
|
-
|
23
|
-
# This step is not necessary if you add the gem to your Gemfile
|
24
|
-
- name: Install Code Scanning integration
|
25
|
-
run: bundle add code-scanning-rubocop --version 0.4.0 --skip-install
|
26
|
-
|
27
|
-
- name: Install dependencies
|
28
|
-
run: bundle install
|
29
|
-
|
30
|
-
- name: Rubocop run
|
31
|
-
run: |
|
32
|
-
bash -c "
|
33
|
-
bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
|
34
|
-
[[ $? -ne 2 ]]
|
35
|
-
"
|
36
|
-
- name: Upload Sarif output
|
37
|
-
uses: github/codeql-action/upload-sarif@v1
|
38
|
-
with:
|
39
|
-
sarif_file: rubocop.sarif
|
data/.github/workflows/spec.yml
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
name: Spec
|
2
|
-
|
3
|
-
on: [push]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
test:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
strategy:
|
9
|
-
matrix:
|
10
|
-
ruby: ['2.7' , '3.0', '3.1', "3.2", "truffleruby+graalvm-head"]
|
11
|
-
name: ${{ matrix.ruby }}
|
12
|
-
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v1
|
15
|
-
- name: Set up ruby
|
16
|
-
uses: ruby/setup-ruby@v1
|
17
|
-
with:
|
18
|
-
ruby-version: ${{ matrix.ruby }}
|
19
|
-
- name: Install dependencies
|
20
|
-
run: bundle install
|
21
|
-
- name: Test
|
22
|
-
if: ${{ contains(matrix.ruby, 'truffleruby') }}
|
23
|
-
run: bundle exec rspec --exclude-pattern "**/*_pattern_matching_spec.rb"
|
24
|
-
- name: Test
|
25
|
-
if: ${{ !contains(matrix.ruby, 'truffleruby') }}
|
26
|
-
run: bundle exec rspec
|
27
|
-
- name: Coveralls
|
28
|
-
uses: coverallsapp/github-action@v1.1.2
|
29
|
-
with:
|
30
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
31
|
-
flag-name: ruby-${{ matrix.ruby }}
|
32
|
-
parallel: true
|
33
|
-
|
34
|
-
|
35
|
-
finish:
|
36
|
-
needs: test
|
37
|
-
runs-on: ubuntu-latest
|
38
|
-
steps:
|
39
|
-
- name: Coveralls Finished
|
40
|
-
uses: coverallsapp/github-action@master
|
41
|
-
with:
|
42
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
43
|
-
parallel-finished: true
|
data/.rubocop.yml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
> bundle exec rake perf:fear:pattern_extracting_with_vs_without_cache
|
2
|
-
Warming up --------------------------------------
|
3
|
-
With cache 1.555k i/100ms
|
4
|
-
Without cache 164.000 i/100ms
|
5
|
-
Calculating -------------------------------------
|
6
|
-
With cache 26.159M (±14.7%) i/s - 124.607M in 4.958175s
|
7
|
-
Without cache 278.285k (±10.5%) i/s - 1.368M in 4.993567s
|
8
|
-
|
9
|
-
Comparison:
|
10
|
-
With cache: 26159162.8 i/s
|
11
|
-
Without cache: 278285.4 i/s - 94.00x slower
|
@@ -1,11 +0,0 @@
|
|
1
|
-
> bundle exec rake perf:pattern_matching:qo_vs_fear_pattern_extraction
|
2
|
-
Warming up --------------------------------------
|
3
|
-
Qo 12.352k i/100ms
|
4
|
-
Fear 6.841k i/100ms
|
5
|
-
Calculating -------------------------------------
|
6
|
-
Qo 142.416k (± 4.3%) i/s - 716.416k in 5.040430s
|
7
|
-
Fear 88.179k (± 4.8%) i/s - 444.665k in 5.055908s
|
8
|
-
|
9
|
-
Comparison:
|
10
|
-
Qo: 142415.6 i/s
|
11
|
-
Fear: 88179.5 i/s - 1.62x slower
|
@@ -1,11 +0,0 @@
|
|
1
|
-
> bundle exec rake perf:pattern_matching:qo_vs_fear_try_execution
|
2
|
-
Warming up --------------------------------------
|
3
|
-
Qo 10.079k i/100ms
|
4
|
-
Fear 25.868k i/100ms
|
5
|
-
Calculating -------------------------------------
|
6
|
-
Qo 142.209k (± 3.8%) i/s - 715.609k in 5.039975s
|
7
|
-
Fear 395.999k (± 2.5%) i/s - 1.992M in 5.033046s
|
8
|
-
|
9
|
-
Comparison:
|
10
|
-
Fear: 395999.2 i/s
|
11
|
-
Qo: 142209.4 i/s - 2.78x slower
|