dry-monads-sorbet 1.1.0.pre.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +63 -5
- data/dry-monads-sorbet.gemspec +6 -0
- data/lib/bundled_rbi/dry-monads.rbi +3 -0
- data/lib/dry-monads-sorbet.rb +1 -2
- data/lib/dry-monads-sorbet/Rakefile +2 -0
- data/lib/dry-monads-sorbet/railtie.rb +14 -0
- data/lib/dry-monads-sorbet/tasks/dry_monads_sorbet.rake +5 -3
- data/lib/dry/monads/sorbet/version.rb +1 -1
- data/rbi/dry-monads.rbi +593 -0
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c5965a0f167ece1beaf05b22c473323d653e4b6c34600b01890127264186368
|
4
|
+
data.tar.gz: 290798ca858d2101ead489df61ba3321eebad985145ac19f04aa78bd810ef9ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45cf68ceaed400c7b1baed20b7085cfc664ea4a1e554a9078a55b5d7252ca391a8011155482fa6165ca5530c92d402b55a38e30489016a79ea26277d5514bdb3
|
7
|
+
data.tar.gz: b56702acd5840bf58fbfcff813ce4bf954d7967b9882f614af9261a8e6367baed03ea445bea5adc40e467ec5ea81924b3dee32761c464fbf990a9d83ce0508d2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,19 +4,77 @@
|
|
4
4
|
|
5
5
|
Sorbet type hints for Dry::Monads.
|
6
6
|
|
7
|
-
|
7
|
+
This gem is very small, it opens up the `Dry::Monads::Result` and `Dry::Monads::Maybe` classes to add type members
|
8
|
+
that are subsequently referred to in a bundled `.rbi` file for the `dry-monads` gem.
|
9
|
+
|
10
|
+
The bundled rbi annotations are installed/updated via a rake task included in the gem.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add the gem to your Gemfile:
|
8
15
|
|
9
16
|
`gem 'dry-monads-sorbet'`
|
10
17
|
|
18
|
+
### Copying the bundled RBI
|
19
|
+
|
20
|
+
You must copy in the bundled `.rbi` file that this gem maintains to add type annotations to your own project to type check your usage of `Dry::Monads`.
|
21
|
+
|
22
|
+
Following in the footsteps of `sorbet-rails` we've extracted this process to a rake task.
|
23
|
+
|
24
|
+
### In a Rails project:
|
25
|
+
|
26
|
+
The rake task that copies the bundled `.rbi` files into your project should already be loaded. You can run it by entering:
|
27
|
+
|
28
|
+
```bash
|
29
|
+
bundle exec rake dry_monads_sorbet:update_rbi
|
30
|
+
```
|
31
|
+
|
32
|
+
### Outside of Rails projects:
|
33
|
+
|
34
|
+
Include the `Rakefile` in your own projects `Rakefile` to get access to the rbi update command:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
require 'dry-monads-sorbet'
|
38
|
+
|
39
|
+
spec = Gem::Specification.find_by_name 'dry-monads-sorbet'
|
40
|
+
rakefile = "#{spec.gem_dir}/lib/dry-monads-sorbet/Rakefile"
|
41
|
+
load rakefile
|
42
|
+
```
|
43
|
+
|
44
|
+
After including the Rakefile you should then have access to the task as described in the Rails project section.
|
45
|
+
|
11
46
|
## Usage
|
12
47
|
|
48
|
+
Usage is fairly simple, just annotate your methods as follows:
|
49
|
+
|
13
50
|
```ruby
|
14
51
|
require 'dry/monads/sorbet'
|
15
52
|
|
16
|
-
class
|
53
|
+
class MyLoginService
|
17
54
|
extend T::Sig
|
18
55
|
|
19
|
-
sig{returns(Dry::Monads::Result[StandardError, String])}
|
20
|
-
def
|
21
|
-
|
56
|
+
sig{params(username: String).returns(Dry::Monads::Result[StandardError, String])}
|
57
|
+
def check_username(username)
|
58
|
+
case username
|
59
|
+
when 'samuelgiles93'
|
60
|
+
Dry::Monads::Success('Hi Sam!')
|
61
|
+
else
|
62
|
+
Dry::Monads::Failure(
|
63
|
+
StandardError.new('Unauthorised')
|
64
|
+
)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
sig{params(username: String).returns(Dry::Monads::Maybe[Integer])}
|
69
|
+
def find_fullname(username)
|
70
|
+
case username
|
71
|
+
when 'samuelgiles93'
|
72
|
+
Dry::Monads::Some('Samuel Giles')
|
73
|
+
else
|
74
|
+
Dry::Monads::None()
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
22
78
|
```
|
79
|
+
|
80
|
+
With the type annotations in place you'll get type errors when you attempt to say call a method that doesn't exist on the `Some` of a `Maybe` or the `Success` of a `Result`.
|
data/dry-monads-sorbet.gemspec
CHANGED
@@ -21,6 +21,12 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = 'exe'
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
|
+
spec.post_install_message = <<~TEXT
|
25
|
+
dry-monads-sorbet has been installed/updated.
|
26
|
+
|
27
|
+
This gem ships with a bundled rbi file that must be copied into your project.
|
28
|
+
You can use the included "dry_monads_sorbet:update_rbi" to do this.
|
29
|
+
TEXT
|
24
30
|
|
25
31
|
spec.add_dependency 'sorbet'
|
26
32
|
spec.add_dependency 'sorbet-runtime'
|
@@ -1,5 +1,8 @@
|
|
1
1
|
# typed: strong
|
2
2
|
#
|
3
|
+
# This rbi file is bundled in the dry-monads-sorbet gem and is copied down
|
4
|
+
# into projects using the dry_monads_sorbet:update_rbi rake task.
|
5
|
+
#
|
3
6
|
# Any changes to the type annotations for Dry::Monads should be made
|
4
7
|
# in the dry-monads-sorbet gem itself in its bundled_rbi directory.
|
5
8
|
|
data/lib/dry-monads-sorbet.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
module DryMonadsSorbet
|
6
|
+
class Railtie < Rails::Railtie
|
7
|
+
railtie_name 'dry-monads-sorbet'
|
8
|
+
|
9
|
+
rake_tasks do
|
10
|
+
path = File.expand_path(__dir__)
|
11
|
+
Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,23 +1,25 @@
|
|
1
1
|
require 'dry-monads-sorbet'
|
2
|
+
require 'pathname'
|
2
3
|
|
3
4
|
DRY_MONADS_SORBET_RAKE_DIR = File.dirname(__FILE__)
|
4
5
|
|
5
6
|
namespace :dry_monads_sorbet do
|
6
|
-
|
7
|
+
desc "Generate rbis for dry/monads"
|
8
|
+
task :update_rbi do
|
7
9
|
FileUtils.rm_rf(dry_monads_sorbet_rbi_path)
|
8
10
|
|
9
11
|
copy_bundled_rbi('dry-monads.rbi')
|
10
12
|
end
|
11
13
|
|
12
14
|
def dry_monads_sorbet_rbi_path
|
13
|
-
Rake.original_dir.join('sorbet', 'dry-monads-sorbet')
|
15
|
+
Pathname.new(Rake.original_dir).join('sorbet', 'dry-monads-sorbet')
|
14
16
|
end
|
15
17
|
|
16
18
|
def copy_bundled_rbi(filename)
|
17
|
-
puts "Copy bundled file #{filename}"
|
18
19
|
bundled_rbi_file_path = File.join(DRY_MONADS_SORBET_RAKE_DIR, '..', '..', 'bundled_rbi', filename)
|
19
20
|
copy_to_path = dry_monads_sorbet_rbi_path.join(filename)
|
20
21
|
FileUtils.mkdir_p(File.dirname(copy_to_path))
|
21
22
|
FileUtils.cp(bundled_rbi_file_path, copy_to_path)
|
23
|
+
puts "Copied bundled rbi file: #{filename}"
|
22
24
|
end
|
23
25
|
end
|
data/rbi/dry-monads.rbi
ADDED
@@ -0,0 +1,593 @@
|
|
1
|
+
# typed: strong
|
2
|
+
#
|
3
|
+
# dry-monads-1.3.1
|
4
|
+
#
|
5
|
+
# Note: This file depends on dry/monads/sorbet to define generics.
|
6
|
+
|
7
|
+
module Dry
|
8
|
+
end
|
9
|
+
module Dry::Monads
|
10
|
+
def self.Result(error, **options); end
|
11
|
+
def self.[](*monads); end
|
12
|
+
def self.all_loaded?; end
|
13
|
+
def self.constructors; end
|
14
|
+
def self.included(base); end
|
15
|
+
def self.known_monads; end
|
16
|
+
def self.load_monad(name); end
|
17
|
+
def self.register_mixin(name, mod); end
|
18
|
+
def self.registry; end
|
19
|
+
def self.registry=(registry); end
|
20
|
+
extend Dry::Monads::Maybe::Mixin::Constructors
|
21
|
+
extend Dry::Monads::Maybe::Mixin::Constructors
|
22
|
+
extend Dry::Monads::Result::Mixin::Constructors
|
23
|
+
extend Dry::Monads::Validated::Mixin::Constructors
|
24
|
+
end
|
25
|
+
module Dry::Monads::Curry
|
26
|
+
def self.call(value); end
|
27
|
+
end
|
28
|
+
class Dry::Monads::UnwrapError < StandardError
|
29
|
+
def initialize(ctx); end
|
30
|
+
end
|
31
|
+
class Dry::Monads::InvalidFailureTypeError < StandardError
|
32
|
+
def initialize(failure); end
|
33
|
+
end
|
34
|
+
class Dry::Monads::ConstructorNotAppliedError < NoMethodError
|
35
|
+
def initialize(method_name, constructor_name); end
|
36
|
+
end
|
37
|
+
module Dry::Monads::Transformer
|
38
|
+
def fmap2(*args); end
|
39
|
+
def fmap3(*args); end
|
40
|
+
end
|
41
|
+
class Dry::Monads::Maybe
|
42
|
+
extend T::Helpers
|
43
|
+
abstract!
|
44
|
+
sealed!
|
45
|
+
|
46
|
+
sig do
|
47
|
+
type_parameters(:New)
|
48
|
+
.params(blk: T.proc.params(arg0: Elem).returns(Dry::Monads::Maybe[T.type_parameter(:out, :New)]))
|
49
|
+
.returns(Dry::Monads::Maybe[T.type_parameter(:out, :New)])
|
50
|
+
end
|
51
|
+
def bind(&blk); end
|
52
|
+
|
53
|
+
sig do
|
54
|
+
type_parameters(:New)
|
55
|
+
.params(blk: T.proc.params(arg0: Elem).returns(T.type_parameter(:out, :New)))
|
56
|
+
.returns(Dry::Monads::Maybe[T.type_parameter(:out, :New)])
|
57
|
+
end
|
58
|
+
def fmap(&blk); end
|
59
|
+
|
60
|
+
sig do
|
61
|
+
params(val: T.any(Elem, NilClass),
|
62
|
+
blk: T.nilable(T.proc.returns(Elem)))
|
63
|
+
.returns(Elem)
|
64
|
+
end
|
65
|
+
def value_or(val = nil, &blk); end
|
66
|
+
|
67
|
+
sig do
|
68
|
+
params(arg0: T.untyped)
|
69
|
+
.returns(T.self_type)
|
70
|
+
end
|
71
|
+
def or(*arg0); end
|
72
|
+
|
73
|
+
sig do
|
74
|
+
type_parameters(:Error)
|
75
|
+
.params(val: T.nilable(T.type_parameter(:Error)),
|
76
|
+
blk: T.nilable(T.proc.returns(T.type_parameter(:Error))))
|
77
|
+
.returns(Dry::Monads::Result[T.type_parameter(:out, :Error), Elem])
|
78
|
+
end
|
79
|
+
def to_result(val = nil, &blk); end
|
80
|
+
|
81
|
+
sig {returns(T::Boolean)}
|
82
|
+
def failure?; end
|
83
|
+
def monad; end
|
84
|
+
|
85
|
+
sig {returns(T::Boolean)}
|
86
|
+
def none?; end
|
87
|
+
def self.coerce(value); end
|
88
|
+
def self.lift(*args, &block); end
|
89
|
+
def self.pure(value = nil, &block); end
|
90
|
+
def self.to_proc; end
|
91
|
+
|
92
|
+
sig {returns(T::Boolean)}
|
93
|
+
def some?; end
|
94
|
+
|
95
|
+
sig {returns(T::Boolean)}
|
96
|
+
def success?; end
|
97
|
+
def to_maybe; end
|
98
|
+
def to_monad; end
|
99
|
+
include Dry::Monads::Transformer
|
100
|
+
end
|
101
|
+
class Dry::Monads::Maybe::Some < Dry::Monads::Maybe
|
102
|
+
extend T::Sig
|
103
|
+
extend T::Generic
|
104
|
+
Elem = type_member
|
105
|
+
|
106
|
+
sig {params(value: Elem).void}
|
107
|
+
def initialize(value = nil); end
|
108
|
+
|
109
|
+
sig do
|
110
|
+
returns(Elem)
|
111
|
+
end
|
112
|
+
def value!; end
|
113
|
+
|
114
|
+
def inspect; end
|
115
|
+
def maybe(*args, &block); end
|
116
|
+
def self.[](*value); end
|
117
|
+
def self.call(*arg0); end
|
118
|
+
def self.to_proc; end
|
119
|
+
def to_s; end
|
120
|
+
include Anonymous_Dry_Equalizer_33
|
121
|
+
include Dry::Equalizer::Methods
|
122
|
+
end
|
123
|
+
module Anonymous_Dry_Equalizer_33
|
124
|
+
def cmp?(comparator, other); end
|
125
|
+
def hash; end
|
126
|
+
def inspect; end
|
127
|
+
end
|
128
|
+
class Dry::Monads::Maybe::None < Dry::Monads::Maybe
|
129
|
+
extend T::Sig
|
130
|
+
extend T::Generic
|
131
|
+
Elem = type_member
|
132
|
+
|
133
|
+
def ==(other); end
|
134
|
+
def deconstruct; end
|
135
|
+
def eql?(other); end
|
136
|
+
def hash; end
|
137
|
+
sig {params().void}
|
138
|
+
def initialize(); end
|
139
|
+
def inspect; end
|
140
|
+
def maybe(*arg0); end
|
141
|
+
def or(*args); end
|
142
|
+
def or_fmap(*args, &block); end
|
143
|
+
def self.instance; end
|
144
|
+
def self.method_missing(m, *arg1); end
|
145
|
+
def to_s; end
|
146
|
+
def trace; end
|
147
|
+
include Dry::Core::Constants
|
148
|
+
end
|
149
|
+
module Dry::Monads::Maybe::Mixin
|
150
|
+
include Dry::Monads::Maybe::Mixin::Constructors
|
151
|
+
end
|
152
|
+
module Dry::Monads::Maybe::Mixin::Constructors
|
153
|
+
sig {type_parameters(:T).params(value: T.nilable(T.type_parameter(:T))).returns(Dry::Monads::Maybe[T.type_parameter(:T)])}
|
154
|
+
def Maybe(value); end
|
155
|
+
sig {type_parameters(:T).params().returns(Dry::Monads::Maybe[T.type_parameter(:out, :T)])}
|
156
|
+
def None; end
|
157
|
+
sig {type_parameters(:T).params(value: T.type_parameter(:T)).returns(Dry::Monads::Maybe[T.type_parameter(:T)])}
|
158
|
+
def Some(value = nil); end
|
159
|
+
end
|
160
|
+
module Dry::Monads::Maybe::Hash
|
161
|
+
def self.all(hash, trace = nil); end
|
162
|
+
def self.filter(hash); end
|
163
|
+
end
|
164
|
+
class Dry::Monads::Result
|
165
|
+
extend T::Helpers
|
166
|
+
abstract!
|
167
|
+
sealed!
|
168
|
+
|
169
|
+
sig do
|
170
|
+
type_parameters(:NewSuccessType)
|
171
|
+
.params(blk: T.proc.params(arg0: SuccessType).returns(Dry::Monads::Result[FailureType, T.type_parameter(:out, :NewSuccessType)]))
|
172
|
+
.returns(Dry::Monads::Result[FailureType, T.type_parameter(:out, :NewSuccessType)])
|
173
|
+
end
|
174
|
+
def bind(&blk); end
|
175
|
+
|
176
|
+
sig do
|
177
|
+
type_parameters(:New)
|
178
|
+
.params(blk: T.proc.params(arg0: SuccessType).returns(T.type_parameter(:out, :New)))
|
179
|
+
.returns(Dry::Monads::Result[FailureType, T.type_parameter(:out, :New)])
|
180
|
+
end
|
181
|
+
def fmap(&blk); end
|
182
|
+
|
183
|
+
sig do
|
184
|
+
type_parameters(:Val)
|
185
|
+
.params(val: T.nilable(T.type_parameter(:Val)), blk: T.nilable(T.proc.params(arg0: FailureType).returns(T.type_parameter(:Val))))
|
186
|
+
.returns(T.any(SuccessType, T.type_parameter(:Val)))
|
187
|
+
end
|
188
|
+
def value_or(val = nil, &blk); end
|
189
|
+
|
190
|
+
sig do
|
191
|
+
returns(SuccessType)
|
192
|
+
end
|
193
|
+
def value!; end
|
194
|
+
def to_maybe; end
|
195
|
+
def either(f, _); end
|
196
|
+
|
197
|
+
sig {returns(T::Boolean)}
|
198
|
+
def success?; end
|
199
|
+
|
200
|
+
sig {returns(T::Boolean)}
|
201
|
+
def failure?; end
|
202
|
+
|
203
|
+
sig {returns(FailureType)}
|
204
|
+
def failure; end
|
205
|
+
|
206
|
+
sig do
|
207
|
+
params(blk: T.proc.params(arg0: FailureType).returns(Dry::Monads::Result[FailureType, SuccessType]))
|
208
|
+
.returns(Dry::Monads::Result[FailureType, SuccessType])
|
209
|
+
end
|
210
|
+
def or(&blk); end
|
211
|
+
|
212
|
+
def monad; end
|
213
|
+
def self.pure(value = nil, &block); end
|
214
|
+
def success; end
|
215
|
+
def to_monad; end
|
216
|
+
def to_result; end
|
217
|
+
include Anonymous_Module_34
|
218
|
+
include Dry::Monads::Transformer
|
219
|
+
end
|
220
|
+
class Dry::Monads::Result::Success < Dry::Monads::Result
|
221
|
+
extend T::Sig
|
222
|
+
extend T::Generic
|
223
|
+
FailureType = type_member
|
224
|
+
SuccessType = type_member
|
225
|
+
|
226
|
+
def flip; end
|
227
|
+
def initialize(value); end
|
228
|
+
def inspect; end
|
229
|
+
def result(_, f); end
|
230
|
+
def self.[](*value); end
|
231
|
+
def self.call(*arg0); end
|
232
|
+
def self.to_proc; end
|
233
|
+
def success; end
|
234
|
+
def to_s; end
|
235
|
+
def to_validated; end
|
236
|
+
include Anonymous_Dry_Equalizer_35
|
237
|
+
include Dry::Equalizer::Methods
|
238
|
+
end
|
239
|
+
class Dry::Monads::Result::Failure < Dry::Monads::Result
|
240
|
+
extend T::Sig
|
241
|
+
extend T::Generic
|
242
|
+
FailureType = type_member
|
243
|
+
SuccessType = type_member
|
244
|
+
|
245
|
+
def ===(other); end
|
246
|
+
def failure; end
|
247
|
+
def flip; end
|
248
|
+
def initialize(value, trace = nil); end
|
249
|
+
def inspect; end
|
250
|
+
def or_fmap(*args, &block); end
|
251
|
+
def result(f, _); end
|
252
|
+
def self.[](*value); end
|
253
|
+
def self.call(*arg0); end
|
254
|
+
def self.to_proc; end
|
255
|
+
def to_s; end
|
256
|
+
def to_validated; end
|
257
|
+
def trace; end
|
258
|
+
def value_or(val = nil); end
|
259
|
+
include Anonymous_Dry_Equalizer_36
|
260
|
+
include Dry::Equalizer::Methods
|
261
|
+
end
|
262
|
+
class Dry::Monads::Task
|
263
|
+
def ==(other); end
|
264
|
+
def apply(val = nil); end
|
265
|
+
def bind(&block); end
|
266
|
+
def compare_promises(x, y); end
|
267
|
+
def complete?; end
|
268
|
+
def curry(value); end
|
269
|
+
def discard; end
|
270
|
+
def fmap(&block); end
|
271
|
+
def initialize(promise); end
|
272
|
+
def inspect; end
|
273
|
+
def monad; end
|
274
|
+
def or(&block); end
|
275
|
+
def or_fmap(&block); end
|
276
|
+
def promise; end
|
277
|
+
def self.[](executor, &block); end
|
278
|
+
def self.failed(exc); end
|
279
|
+
def self.new(promise = nil, &block); end
|
280
|
+
def self.pure(value = nil, &block); end
|
281
|
+
def then(&block); end
|
282
|
+
def to_maybe; end
|
283
|
+
def to_monad; end
|
284
|
+
def to_result; end
|
285
|
+
def to_s; end
|
286
|
+
def value!; end
|
287
|
+
def value_or(&block); end
|
288
|
+
def wait(timeout = nil); end
|
289
|
+
include Anonymous_Module_37
|
290
|
+
end
|
291
|
+
class Dry::Monads::Try
|
292
|
+
def error?; end
|
293
|
+
def exception; end
|
294
|
+
def failure?; end
|
295
|
+
def self.[](*exceptions, &block); end
|
296
|
+
def self.lift(*args, &block); end
|
297
|
+
def self.pure(value = nil, exceptions = nil, &block); end
|
298
|
+
def self.run(exceptions, f); end
|
299
|
+
def success?; end
|
300
|
+
def to_monad; end
|
301
|
+
def value?; end
|
302
|
+
include Anonymous_Module_38
|
303
|
+
end
|
304
|
+
class Dry::Monads::Try::Value < Dry::Monads::Try
|
305
|
+
extend T::Generic
|
306
|
+
FailureType = type_member
|
307
|
+
SuccessType = type_member
|
308
|
+
|
309
|
+
def bind(*args); end
|
310
|
+
def bind_call(*args, **kwargs); end
|
311
|
+
def catchable; end
|
312
|
+
def fmap(*args, &block); end
|
313
|
+
def initialize(exceptions, value); end
|
314
|
+
def inspect; end
|
315
|
+
def self.call(*arg0); end
|
316
|
+
def self.to_proc; end
|
317
|
+
def to_maybe; end
|
318
|
+
def to_result; end
|
319
|
+
def to_s; end
|
320
|
+
include Anonymous_Dry_Equalizer_39
|
321
|
+
include Dry::Equalizer::Methods
|
322
|
+
end
|
323
|
+
class Dry::Monads::Try::Error < Dry::Monads::Try
|
324
|
+
extend T::Generic
|
325
|
+
FailureType = type_member
|
326
|
+
SuccessType = type_member
|
327
|
+
|
328
|
+
def ===(other); end
|
329
|
+
def initialize(exception); end
|
330
|
+
def inspect; end
|
331
|
+
def or(*args); end
|
332
|
+
def self.call(*arg0); end
|
333
|
+
def to_maybe; end
|
334
|
+
def to_result; end
|
335
|
+
def to_s; end
|
336
|
+
include Anonymous_Dry_Equalizer_40
|
337
|
+
include Dry::Equalizer::Methods
|
338
|
+
end
|
339
|
+
class Dry::Monads::Validated
|
340
|
+
def bind(*arg0); end
|
341
|
+
def self.pure(value = nil, &block); end
|
342
|
+
def to_monad; end
|
343
|
+
include Anonymous_Module_41
|
344
|
+
end
|
345
|
+
class Dry::Monads::Validated::Valid < Dry::Monads::Validated
|
346
|
+
def ===(other); end
|
347
|
+
def alt_map(_ = nil); end
|
348
|
+
def apply(val = nil); end
|
349
|
+
def fmap(proc = nil, &block); end
|
350
|
+
def initialize(value); end
|
351
|
+
def inspect; end
|
352
|
+
def or(_ = nil); end
|
353
|
+
def to_maybe; end
|
354
|
+
def to_result; end
|
355
|
+
def to_s; end
|
356
|
+
def value!; end
|
357
|
+
include Anonymous_Dry_Equalizer_42
|
358
|
+
include Dry::Equalizer::Methods
|
359
|
+
end
|
360
|
+
class Dry::Monads::Validated::Invalid < Dry::Monads::Validated
|
361
|
+
def ===(other); end
|
362
|
+
def alt_map(proc = nil, &block); end
|
363
|
+
def apply(val = nil); end
|
364
|
+
def error; end
|
365
|
+
def fmap(_ = nil); end
|
366
|
+
def initialize(error, trace = nil); end
|
367
|
+
def inspect; end
|
368
|
+
def or(proc = nil, &block); end
|
369
|
+
def to_maybe; end
|
370
|
+
def to_result; end
|
371
|
+
def to_s; end
|
372
|
+
def trace; end
|
373
|
+
include Anonymous_Dry_Equalizer_43
|
374
|
+
include Dry::Equalizer::Methods
|
375
|
+
end
|
376
|
+
module Dry::Monads::ConversionStubs
|
377
|
+
def self.[](*method_names); end
|
378
|
+
end
|
379
|
+
module Dry::Monads::ConversionStubs::Methods
|
380
|
+
def self.to_maybe; end
|
381
|
+
def self.to_result; end
|
382
|
+
def self.to_validated; end
|
383
|
+
def to_maybe; end
|
384
|
+
def to_result; end
|
385
|
+
def to_validated; end
|
386
|
+
end
|
387
|
+
class Dry::Monads::Task::Promise < Concurrent::Promise
|
388
|
+
def on_fulfill(result); end
|
389
|
+
def on_reject(reason); end
|
390
|
+
end
|
391
|
+
module Anonymous_Module_37
|
392
|
+
def to_maybe(*arg0); end
|
393
|
+
def to_result(*arg0); end
|
394
|
+
end
|
395
|
+
module Dry::Monads::Task::Mixin
|
396
|
+
def self.[](executor); end
|
397
|
+
include Dry::Monads::Task::Mixin::Constructors
|
398
|
+
end
|
399
|
+
module Dry::Monads::Task::Mixin::Constructors
|
400
|
+
def Task(&block); end
|
401
|
+
end
|
402
|
+
module Anonymous_Module_34
|
403
|
+
def to_maybe(*arg0); end
|
404
|
+
def to_validated(*arg0); end
|
405
|
+
end
|
406
|
+
module Anonymous_Dry_Equalizer_35
|
407
|
+
def cmp?(comparator, other); end
|
408
|
+
def hash; end
|
409
|
+
def inspect; end
|
410
|
+
end
|
411
|
+
module Anonymous_Dry_Equalizer_36
|
412
|
+
def cmp?(comparator, other); end
|
413
|
+
def hash; end
|
414
|
+
def inspect; end
|
415
|
+
end
|
416
|
+
module Dry::Monads::Result::Mixin
|
417
|
+
include Dry::Monads::Result::Mixin::Constructors
|
418
|
+
end
|
419
|
+
module Dry::Monads::Result::Mixin::Constructors
|
420
|
+
sig do
|
421
|
+
type_parameters(:FailureType, :SuccessType)
|
422
|
+
.params(value: T.nilable(T.type_parameter(:FailureType)),
|
423
|
+
block: T.nilable(T.untyped))
|
424
|
+
.returns(Dry::Monads::Result[T.type_parameter(:FailureType),
|
425
|
+
T.type_parameter(:out, :SuccessType)])
|
426
|
+
end
|
427
|
+
def Failure(value = nil, &block); end
|
428
|
+
|
429
|
+
sig do
|
430
|
+
type_parameters(:FailureType, :SuccessType)
|
431
|
+
.params(value: T.nilable(T.type_parameter(:SuccessType)),
|
432
|
+
block: T.nilable(T.untyped))
|
433
|
+
.returns(Dry::Monads::Result[T.type_parameter(:out, :FailureType),
|
434
|
+
T.type_parameter(:SuccessType)])
|
435
|
+
end
|
436
|
+
def Success(value = nil, &block); end
|
437
|
+
end
|
438
|
+
module Anonymous_Module_38
|
439
|
+
def to_maybe(*arg0); end
|
440
|
+
def to_result(*arg0); end
|
441
|
+
end
|
442
|
+
module Anonymous_Dry_Equalizer_39
|
443
|
+
def cmp?(comparator, other); end
|
444
|
+
def hash; end
|
445
|
+
def inspect; end
|
446
|
+
end
|
447
|
+
module Anonymous_Dry_Equalizer_40
|
448
|
+
def cmp?(comparator, other); end
|
449
|
+
def hash; end
|
450
|
+
def inspect; end
|
451
|
+
end
|
452
|
+
module Dry::Monads::Try::Mixin
|
453
|
+
def Error(error = nil, &block); end
|
454
|
+
def Value(value = nil, exceptions = nil, &block); end
|
455
|
+
include Dry::Monads::Try::Mixin::Constructors
|
456
|
+
end
|
457
|
+
module Dry::Monads::Try::Mixin::Constructors
|
458
|
+
def Try(*exceptions, &f); end
|
459
|
+
end
|
460
|
+
module Anonymous_Module_41
|
461
|
+
def to_maybe(*arg0); end
|
462
|
+
def to_result(*arg0); end
|
463
|
+
end
|
464
|
+
module Anonymous_Dry_Equalizer_42
|
465
|
+
def cmp?(comparator, other); end
|
466
|
+
def hash; end
|
467
|
+
def inspect; end
|
468
|
+
end
|
469
|
+
module Anonymous_Dry_Equalizer_43
|
470
|
+
def cmp?(comparator, other); end
|
471
|
+
def hash; end
|
472
|
+
def inspect; end
|
473
|
+
end
|
474
|
+
module Dry::Monads::Validated::Mixin
|
475
|
+
include Dry::Monads::Validated::Mixin::Constructors
|
476
|
+
end
|
477
|
+
module Dry::Monads::Validated::Mixin::Constructors
|
478
|
+
def Invalid(value = nil, &block); end
|
479
|
+
def Valid(value = nil, &block); end
|
480
|
+
end
|
481
|
+
class Dry::Monads::List
|
482
|
+
def +(other); end
|
483
|
+
def apply(list = nil); end
|
484
|
+
def bind(*args); end
|
485
|
+
def coerce(other); end
|
486
|
+
def collect; end
|
487
|
+
def deconstruct; end
|
488
|
+
def empty?; end
|
489
|
+
def filter; end
|
490
|
+
def first; end
|
491
|
+
def fmap(*args); end
|
492
|
+
def fold_left(initial); end
|
493
|
+
def fold_right(initial); end
|
494
|
+
def foldl(initial); end
|
495
|
+
def foldr(initial); end
|
496
|
+
def head; end
|
497
|
+
def initialize(value, type = nil); end
|
498
|
+
def inspect; end
|
499
|
+
def last; end
|
500
|
+
def map(&block); end
|
501
|
+
def monad; end
|
502
|
+
def reduce(initial); end
|
503
|
+
def reverse; end
|
504
|
+
def select; end
|
505
|
+
def self.[](*values); end
|
506
|
+
def self.coerce(value, type = nil); end
|
507
|
+
def self.pure(value = nil, type = nil, &block); end
|
508
|
+
def self.unfold(state, type = nil); end
|
509
|
+
def size; end
|
510
|
+
def sort; end
|
511
|
+
def tail; end
|
512
|
+
def to_a; end
|
513
|
+
def to_ary; end
|
514
|
+
def to_monad; end
|
515
|
+
def to_s; end
|
516
|
+
def traverse(proc = nil, &block); end
|
517
|
+
def type; end
|
518
|
+
def typed(type = nil); end
|
519
|
+
def typed?; end
|
520
|
+
def value; end
|
521
|
+
extend Anonymous_Dry_Core_Deprecations_Tagged_44
|
522
|
+
extend Dry::Core::Deprecations::Interface
|
523
|
+
include Anonymous_Dry_Equalizer_45
|
524
|
+
include Dry::Equalizer::Methods
|
525
|
+
include Dry::Monads::Transformer
|
526
|
+
end
|
527
|
+
module Anonymous_Dry_Core_Deprecations_Tagged_44
|
528
|
+
end
|
529
|
+
module Anonymous_Dry_Equalizer_45
|
530
|
+
def cmp?(comparator, other); end
|
531
|
+
def hash; end
|
532
|
+
def inspect; end
|
533
|
+
end
|
534
|
+
class Dry::Monads::List::ListBuilder
|
535
|
+
def [](*args); end
|
536
|
+
def coerce(value); end
|
537
|
+
def initialize(type); end
|
538
|
+
def pure(val = nil, &block); end
|
539
|
+
def self.[](*arg0); end
|
540
|
+
def type; end
|
541
|
+
end
|
542
|
+
module Dry::Monads::List::Mixin
|
543
|
+
def List(value); end
|
544
|
+
end
|
545
|
+
module Dry::Monads::Do
|
546
|
+
def self.coerce_to_monad(monads); end
|
547
|
+
def self.for(*methods); end
|
548
|
+
def self.halt(result); end
|
549
|
+
def self.included(base); end
|
550
|
+
def self.wrap_method(target, method_name); end
|
551
|
+
extend Dry::Monads::Do::Mixin
|
552
|
+
end
|
553
|
+
module Dry::Monads::Do::Mixin
|
554
|
+
def bind(monads); end
|
555
|
+
def call; end
|
556
|
+
end
|
557
|
+
class Dry::Monads::Do::Halt < StandardError
|
558
|
+
def initialize(result); end
|
559
|
+
def result; end
|
560
|
+
end
|
561
|
+
module Dry::Monads::Do::All
|
562
|
+
def self.included(base); end
|
563
|
+
extend Dry::Monads::Do::All::InstanceMixin
|
564
|
+
end
|
565
|
+
class Dry::Monads::Do::All::MethodTracker < Module
|
566
|
+
def extend_object(target); end
|
567
|
+
def initialize(wrappers); end
|
568
|
+
def wrap_method(target, method); end
|
569
|
+
def wrappers; end
|
570
|
+
end
|
571
|
+
module Dry::Monads::Do::All::InstanceMixin
|
572
|
+
def extended(object); end
|
573
|
+
end
|
574
|
+
class Dry::Monads::Lazy < Dry::Monads::Task
|
575
|
+
def force!; end
|
576
|
+
def force; end
|
577
|
+
def inspect; end
|
578
|
+
def self.[](executor, &block); end
|
579
|
+
def self.new(promise = nil, &block); end
|
580
|
+
def to_s; end
|
581
|
+
def value!; end
|
582
|
+
end
|
583
|
+
module Dry::Monads::Lazy::Mixin
|
584
|
+
include Dry::Monads::Lazy::Mixin::Constructors
|
585
|
+
end
|
586
|
+
module Dry::Monads::Lazy::Mixin::Constructors
|
587
|
+
def Lazy(&block); end
|
588
|
+
end
|
589
|
+
class Dry::Monads::Result::Fixed < Module
|
590
|
+
def included(base); end
|
591
|
+
def initialize(error, **options); end
|
592
|
+
def self.[](error, **options); end
|
593
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-monads-sorbet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Worth
|
@@ -131,14 +131,21 @@ files:
|
|
131
131
|
- dry-monads-sorbet.gemspec
|
132
132
|
- lib/bundled_rbi/dry-monads.rbi
|
133
133
|
- lib/dry-monads-sorbet.rb
|
134
|
+
- lib/dry-monads-sorbet/Rakefile
|
135
|
+
- lib/dry-monads-sorbet/railtie.rb
|
134
136
|
- lib/dry-monads-sorbet/tasks/dry_monads_sorbet.rake
|
135
137
|
- lib/dry/monads/sorbet.rb
|
136
138
|
- lib/dry/monads/sorbet/version.rb
|
139
|
+
- rbi/dry-monads.rbi
|
137
140
|
homepage: https://github.com/tricycle/dry-monads-sorbet
|
138
141
|
licenses:
|
139
142
|
- MIT
|
140
143
|
metadata: {}
|
141
|
-
post_install_message:
|
144
|
+
post_install_message: |
|
145
|
+
dry-monads-sorbet has been installed/updated.
|
146
|
+
|
147
|
+
This gem ships with a bundled rbi file that must be copied into your project.
|
148
|
+
You can use the included "dry_monads_sorbet:update_rbi" to do this.
|
142
149
|
rdoc_options: []
|
143
150
|
require_paths:
|
144
151
|
- lib
|
@@ -149,9 +156,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
156
|
version: '0'
|
150
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
158
|
requirements:
|
152
|
-
- - "
|
159
|
+
- - ">="
|
153
160
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
161
|
+
version: '0'
|
155
162
|
requirements: []
|
156
163
|
rubygems_version: 3.1.2
|
157
164
|
signing_key:
|