dry-monads 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b5983b622b49edc1008fc8717adf6f4150f011c55ca094879f6788cfed657f2
4
- data.tar.gz: 8e01a982d197dbc26e82df01c804dba93e8aa327aeb9cb248a07eeda7a7c636c
3
+ metadata.gz: 89a089888f5511f4ab76971cae27948689a4137fb3122401c246bbc67ce58049
4
+ data.tar.gz: ded502b6c132f7e84c4d3d42ae69ed9a999d3ca83f085498599e7b6bb58eb5e1
5
5
  SHA512:
6
- metadata.gz: f81e00f7455a03b12996724fd35404d81dff4cbc934e1868a2329c26cbaae5cb7f5edcde6c9766f754844e8ce0b839d5ca10781e0c1c08702020e938956703b3
7
- data.tar.gz: 4ea9d2ffa5988996517ba096ef8985331a213fadbdb6d81b2597012a0d7ada3da3716422ba155accd0a9932bf5802a905a3b19162526c5f2a501f45e0b46537e
6
+ metadata.gz: a10c20a7a0c870fcbc18df563e3284917308e1f4ff6eec5e39af2bad02bcd7ed185233fd62e39f05dea5a2d1190440515225d6cba4a045f3a57c7b6505bfdbfd
7
+ data.tar.gz: b42f96d99629bee47c10d7a28bd13f3fb2a0d5e320efc6617167bd593e0df183a27a7e3b49f22bdc6b7af99e2c989170f9efcc32a0fa71fe4b0f766e0b533251
@@ -3,26 +3,23 @@ dist: trusty
3
3
  cache: bundler
4
4
  bundler_args: --without benchmarks docs
5
5
  script:
6
- - bundle exec rspec spec $RSPEC_OPTS
6
+ - bundle exec rspec spec
7
7
  before_install:
8
8
  - gem update --system
9
9
  - gem install bundler
10
10
  after_success:
11
11
  - "[ -d coverage ] && bundle exec codeclimate-test-reporter"
12
12
  rvm:
13
- - 2.4.6
14
- - 2.5.5
15
- - 2.6.3
13
+ - 2.4.7
14
+ - 2.5.6
15
+ - 2.6.4
16
+ - ruby-head
16
17
  - jruby-9.2.7.0
17
18
  env:
18
19
  global:
19
20
  - JRUBY_OPTS='--dev -J-Xmx1024M'
20
21
  - COVERAGE=true
21
- - RSPEC_OPTS='--exclude-pattern spec/integration/pattern_matching_spec.rb'
22
22
  matrix:
23
- include:
24
- - rvm: 2.7
25
- env: "RSPEC_OPTS=''"
26
23
  allow_failures:
27
24
  - rvm: ruby-head
28
25
 
@@ -1,23 +1,31 @@
1
+ # v1.3.1 2019-09-07
2
+
3
+ ## Fixed
4
+
5
+ - Added missing `None#maybe` :sweat_smile: (flash-gordon)
6
+
7
+ [Compare v1.3.0...v1.3.1](https://github.com/dry-rb/dry-monads/compare/v1.3.0...v1.3.1)
8
+
1
9
  # v1.3.0 2019-08-03
2
10
 
3
11
  ## BREAKING CHANGES
4
12
 
5
- * Support for Ruby 2.3 was dropped.
13
+ - Support for Ruby 2.3 was dropped.
6
14
 
7
15
  ## Added
8
16
 
9
- * `Result#either` (waiting-for-dev)
17
+ - `Result#either` (waiting-for-dev)
10
18
  ```ruby
11
19
  Success(1).either(-> x { x + 1 }, -> x { x + 2 }) # => 2
12
20
  Failure(1).either(-> x { x + 1 }, -> x { x + 2 }) # => 3
13
21
  ```
14
- * `Maybe#to_result` (SpyMachine + flash-gordon)
22
+ - `Maybe#to_result` (SpyMachine + flash-gordon)
15
23
  ```ruby
16
24
  Some(3).to_result(:no_value) # => Success(3)
17
25
  None().to_result { :no_value } # => Failure(:no_value)
18
26
  None().to_result # => Failure()
19
27
  ```
20
- * Do notation can be used with `extend`. This simplifies usage in class methods and in other "complicated" cases (gogiel + flash-gordon)
28
+ - Do notation can be used with `extend`. This simplifies usage in class methods and in other "complicated" cases (gogiel + flash-gordon)
21
29
 
22
30
  ```ruby
23
31
  class CreateUser
@@ -34,24 +42,27 @@
34
42
  end
35
43
  end
36
44
  ```
37
-
45
+
38
46
  Or you can bind values directly:
47
+
39
48
  ```ruby
40
49
  ma = Dry::Monads.Success(1)
41
50
  mb = Dry::Monads.Success(2)
42
-
51
+
43
52
  Dry::Monads::Do.() do
44
53
  a = Dry::Monads::Do.bind(ma)
45
54
  b = Dry::Monads::Do.bind(mb)
46
-
55
+
47
56
  Dry::Monads.Success(a + b)
48
57
  end
49
58
  ```
50
- * `{Some,Success,Failure}#[]` shortcuts for building arrays wrapped within monadic value (flash-gordon)
59
+
60
+ - `{Some,Success,Failure}#[]` shortcuts for building arrays wrapped within monadic value (flash-gordon)
51
61
  ```ruby
52
- Success[1, 2] # => Success([1, 2])
62
+ Success[1, 2] # => Success([1, 2])
53
63
  ```
54
- * `List.unfold` yields a block returning `Maybe<Any>`. If the block returns `Some(a)` `a` is appended to the output list. Returning `None` halts the unfloding (flash-gordon)
64
+ - `List.unfold` yields a block returning `Maybe<Any>`. If the block returns `Some(a)` `a` is appended to the output list. Returning `None` halts the unfloding (flash-gordon)
65
+
55
66
  ```ruby
56
67
  List.unfold(0) do |x|
57
68
  if x > 5
@@ -61,8 +72,9 @@
61
72
  end
62
73
  end # => List[1, 2, 3, 4, 5]
63
74
  ```
64
-
65
- * Experimental support for pattern matching! :tada: (flash-gordon)
75
+
76
+ - Experimental support for pattern matching! :tada: (flash-gordon)
77
+
66
78
  ```ruby
67
79
  case value
68
80
  in Failure(_) then :failure
@@ -75,28 +87,31 @@
75
87
  in Success({ code: 200..300 => x }) then x
76
88
  end
77
89
  ```
78
- Read more about pattern matching in Ruby:
90
+
91
+ Read more about pattern matching in Ruby:
92
+
79
93
  - https://medium.com/@baweaver/ruby-2-7-pattern-matching-destructuring-on-point-90f56aaf7b4e
80
94
  - https://bugs.ruby-lang.org/issues/14912
81
-
95
+
82
96
  Keep in mind this feature is experimental and can be changed by 2.7 release. But it rocks already!
83
-
97
+
84
98
  [Compare v1.2.0...v1.3.0](https://github.com/dry-rb/dry-monads/compare/v1.2.0...v1.3.0)
85
99
 
86
100
  # v1.2.0 2019-01-12
87
101
 
88
102
  ## BREAKING CHANGES
89
103
 
90
- * Support for Ruby 2.2 was dropped. Ruby 2.2 reached its EOL on March 31, 2018.
104
+ - Support for Ruby 2.2 was dropped. Ruby 2.2 reached its EOL on March 31, 2018.
91
105
 
92
106
  ## Added
93
107
 
94
- * Most of constructors now have `call` alias so you can compose them with Procs nicely if you've switched to Ruby 2.6 (flash-gordon)
108
+ - Most of constructors now have `call` alias so you can compose them with Procs nicely if you've switched to Ruby 2.6 (flash-gordon)
95
109
  ```ruby
96
110
  pipe = -> x { x.upcase } >> Success
97
111
  pipe.('foo') # => Success('FOO')
98
112
  ```
99
- * `List#collect` gathers `Some` values from the list (flash-gordon)
113
+ - `List#collect` gathers `Some` values from the list (flash-gordon)
114
+
100
115
  ```ruby
101
116
  include Dry::Monads::List::Mixin
102
117
  include Dry::Monads::Maybe::Mixin
@@ -118,9 +133,10 @@
118
133
  # => [10, 6]
119
134
  ```
120
135
 
121
- * Right-biased monads got `#flatten` and `#and` (falsh-gordon)
136
+ - Right-biased monads got `#flatten` and `#and` (falsh-gordon)
122
137
 
123
138
  `#flatten` removes one level of monadic structure, it's useful when you're dealing with things like `Maybe` of `Maybe` of something:
139
+
124
140
  ```ruby
125
141
  include Dry::Monads::Maybe::Mixin
126
142
 
@@ -128,11 +144,15 @@
128
144
  Some(None()).flatten # => None
129
145
  None().flatten # => None
130
146
  ```
147
+
131
148
  In contrast to `Array#flatten`, dry-monads' version removes only 1 level of nesting, that is always acts as `Array#flatten(1)`:
149
+
132
150
  ```ruby
133
151
  Some(Some(Some(1))).flatten # => Some(Some(1))
134
152
  ```
153
+
135
154
  `#and` is handy for combining two monadic values and working with them at once:
155
+
136
156
  ```ruby
137
157
  include Dry::Monads::Maybe::Mixin
138
158
 
@@ -145,7 +165,7 @@
145
165
  None().and(Some(5)) # => None()
146
166
  ```
147
167
 
148
- * Concise imports with `Dry::Monads.[]`. You're no longer required to require all desired monads and include them one-by-one, the `[]` method handles it for you (flash-gordon)
168
+ - Concise imports with `Dry::Monads.[]`. You're no longer required to require all desired monads and include them one-by-one, the `[]` method handles it for you (flash-gordon)
149
169
 
150
170
  ```ruby
151
171
  require 'dry/monads'
@@ -169,7 +189,8 @@
169
189
  end
170
190
  end
171
191
  ```
172
- * `Task.failed` is a counterpart of `Task.pure`, accepts an exception and returns a failed task immediately (flash-gordon)
192
+
193
+ - `Task.failed` is a counterpart of `Task.pure`, accepts an exception and returns a failed task immediately (flash-gordon)
173
194
 
174
195
  [Compare v1.1.0...v1.2.0](https://github.com/dry-rb/dry-monads/compare/v1.1.0...v1.2.0)
175
196
 
@@ -177,11 +198,12 @@
177
198
 
178
199
  ## Fixed
179
200
 
180
- * Do notation was made to work nicely with inheritance. This shouldn't break any existing code but if it does please report (flash-gordon)
201
+ - Do notation was made to work nicely with inheritance. This shouldn't break any existing code but if it does please report (flash-gordon)
181
202
 
182
203
  ## Added
183
204
 
184
- * `Success()`, `Failure()`, and `Some()` now have `Unit` as a default argument:
205
+ - `Success()`, `Failure()`, and `Some()` now have `Unit` as a default argument:
206
+
185
207
  ```ruby
186
208
  include Dry::Monads::Result::Mixin
187
209
  include Dry::Monads::Do
@@ -200,11 +222,11 @@
200
222
 
201
223
  ## Fixed
202
224
 
203
- * Fixed behavior of `List<Validated>#traverse` in presence of `Valid` values (flash-gordon + SunnyMagadan)
225
+ - Fixed behavior of `List<Validated>#traverse` in presence of `Valid` values (flash-gordon + SunnyMagadan)
204
226
 
205
227
  ## Added
206
228
 
207
- * `to_proc` was added to value constructors (flash-gordon)
229
+ - `to_proc` was added to value constructors (flash-gordon)
208
230
  ```ruby
209
231
  [1, 2, 3].map(&Some) # => [Some(1), Some(2), Some(3)]
210
232
  ```
@@ -215,7 +237,7 @@
215
237
 
216
238
  ## Added
217
239
 
218
- * `do`-like notation (the idea comes from Haskell of course). This is the biggest and most important addition to the release which greatly increases the ergonomics of using monads in Ruby. Basically, almost everything it does is passing a block to a given method. You call `yield` on monads to extract the values. If any operation fails i.e. no value can be extracted, the whole computation is halted and the failing step becomes a result. With `Do` you don't need to chain monadic values with `fmap/bind` and block, everything can be done on a single level of indentation. Here is a more or less real-life example:
240
+ - `do`-like notation (the idea comes from Haskell of course). This is the biggest and most important addition to the release which greatly increases the ergonomics of using monads in Ruby. Basically, almost everything it does is passing a block to a given method. You call `yield` on monads to extract the values. If any operation fails i.e. no value can be extracted, the whole computation is halted and the failing step becomes a result. With `Do` you don't need to chain monadic values with `fmap/bind` and block, everything can be done on a single level of indentation. Here is a more or less real-life example:
219
241
 
220
242
  ```ruby
221
243
  class CreateUser
@@ -266,7 +288,7 @@
266
288
 
267
289
  In the code above any `yield` can potentially fail and return the failure reason as a result. In other words, `yield None` acts as `return None`. Internally, `Do` uses exceptions, not `return`, this is somewhat slower but allows to detect failed operations in DB-transactions and roll back the changes which far more useful than an unjustifiable speed boost (flash-gordon)
268
290
 
269
- * The `Task` monad based on `Promise` from the [`concurrent-ruby` gem](https://github.com/ruby-concurrency/concurrent-ruby/). `Task` represents an asynchronous computation which _can be_ (doesn't have to!) run on a separated thread. `Promise` already offers a good API and implemented in a safe manner so `dry-monads` just adds a monad-compatible interface for it. Out of the box, `concurrent-ruby` has three types of executors for running blocks: `:io`, `:fast`, `:immediate`, check out [the docs](http://ruby-concurrency.github.io/concurrent-ruby/root/Concurrent.html#executor-class_method) for details. You can provide your own executor if needed (flash-gordon)
291
+ - The `Task` monad based on `Promise` from the [`concurrent-ruby` gem](https://github.com/ruby-concurrency/concurrent-ruby/). `Task` represents an asynchronous computation which _can be_ (doesn't have to!) run on a separated thread. `Promise` already offers a good API and implemented in a safe manner so `dry-monads` just adds a monad-compatible interface for it. Out of the box, `concurrent-ruby` has three types of executors for running blocks: `:io`, `:fast`, `:immediate`, check out [the docs](http://ruby-concurrency.github.io/concurrent-ruby/root/Concurrent.html#executor-class_method) for details. You can provide your own executor if needed (flash-gordon)
270
292
 
271
293
  ```ruby
272
294
  include Dry::Monads::Task::Mixin
@@ -292,9 +314,9 @@
292
314
  end
293
315
  ```
294
316
 
295
- * `Lazy` is a copy of `Task` that isn't run until you ask for the value _for the first time_. It is guaranteed the evaluation is run at most once as opposed to lazy assignment `||=` which isn't synchronized. `Lazy` is run on the same thread asking for the value (flash-gordon)
317
+ - `Lazy` is a copy of `Task` that isn't run until you ask for the value _for the first time_. It is guaranteed the evaluation is run at most once as opposed to lazy assignment `||=` which isn't synchronized. `Lazy` is run on the same thread asking for the value (flash-gordon)
296
318
 
297
- * Automatic type inference with `.typed` for lists was deprecated. Instead, typed list builders were added
319
+ - Automatic type inference with `.typed` for lists was deprecated. Instead, typed list builders were added
298
320
 
299
321
  ```ruby
300
322
  list = List::Task[Task { get_name }, Task { get_email }]
@@ -303,7 +325,7 @@
303
325
 
304
326
  The code above runs two tasks in parallel and automatically combines their results with `traverse` (flash-gordon)
305
327
 
306
- * `Try` got a new call syntax supported in Ruby 2.5+
328
+ - `Try` got a new call syntax supported in Ruby 2.5+
307
329
 
308
330
  ```ruby
309
331
  Try[ArgumentError, TypeError] { unsafe_operation }
@@ -311,7 +333,7 @@
311
333
 
312
334
  Prior to 2.5, it wasn't possible to pass a block to `[]`.
313
335
 
314
- * The `Validated` “monad” that represents a result of a validation. Suppose, you want to collect all the errors and return them at once. You can't have it with `Result` because when you `traverse` a `List` of `Result`s it returns the first value and this is the correct behavior from the theoretical point of view. `Validated`, in fact, doesn't have a monad instance but provides a useful variant of applicative which concatenates the errors.
336
+ - The `Validated` “monad” that represents a result of a validation. Suppose, you want to collect all the errors and return them at once. You can't have it with `Result` because when you `traverse` a `List` of `Result`s it returns the first value and this is the correct behavior from the theoretical point of view. `Validated`, in fact, doesn't have a monad instance but provides a useful variant of applicative which concatenates the errors.
315
337
 
316
338
  ```ruby
317
339
  include Dry::Monads
@@ -335,13 +357,13 @@
335
357
 
336
358
  In the example above an array of `Validated` values is implicitly coerced to `List::Validated`. It's supported because it's useful but don't forget it's all about types so don't mix different types of monads in a single array, the consequences are unclear. You always can be explicit with `List::Validated[validate_name(...), ...]`, choose what you like (flash-gordon).
337
359
 
338
- * `Failure`, `None`, and `Invalid` values now store the line where they were created. One of the biggest downsides of dealing with monadic code is lack of backtraces. If you have a long list of computations and one of them fails how do you know where did it actually happen? Say, you've got `None` and this tells you nothing about _what variable_ was assigned to `None`. It makes sense to use `Result` instead of `Maybe` and use distinct errors everywhere but it doesn't always look good and forces you to think more. TLDR; call `.trace` to get the line where a fail-case was constructed
360
+ - `Failure`, `None`, and `Invalid` values now store the line where they were created. One of the biggest downsides of dealing with monadic code is lack of backtraces. If you have a long list of computations and one of them fails how do you know where did it actually happen? Say, you've got `None` and this tells you nothing about _what variable_ was assigned to `None`. It makes sense to use `Result` instead of `Maybe` and use distinct errors everywhere but it doesn't always look good and forces you to think more. TLDR; call `.trace` to get the line where a fail-case was constructed
339
361
 
340
362
  ```ruby
341
363
  Failure(:invalid_name).trace # => app/operations/create_user.rb:43
342
364
  ```
343
365
 
344
- * `Dry::Monads::Unit` which can be used as a replacement for `Success(nil)` and in similar situations when you have side effects yet doesn't return anything meaningful as a result. There's also the `.discard` method for mapping any successful result (i.e. `Success(?)`, `Some(?)`, `Value(?)`, etc) to `Unit`.
366
+ - `Dry::Monads::Unit` which can be used as a replacement for `Success(nil)` and in similar situations when you have side effects yet doesn't return anything meaningful as a result. There's also the `.discard` method for mapping any successful result (i.e. `Success(?)`, `Some(?)`, `Value(?)`, etc) to `Unit`.
345
367
 
346
368
  ```ruby
347
369
  # we're making an HTTP request but "forget" any successful result,
@@ -353,12 +375,12 @@
353
375
 
354
376
  ## Deprecations
355
377
 
356
- * `Either`, the former name of `Result`, is now deprecated
378
+ - `Either`, the former name of `Result`, is now deprecated
357
379
 
358
380
  ## BREAKING CHANGES
359
381
 
360
- * `Either#value` and `Maybe#value` were both droped, use `value_or` or `value!` when you :100: sure it's safe
361
- * `require 'dry/monads'` doesn't load all monads anymore, use `require 'dry/monads/all'` instead or cherry pick them with `require 'dry/monads/maybe'` etc (timriley)
382
+ - `Either#value` and `Maybe#value` were both droped, use `value_or` or `value!` when you :100: sure it's safe
383
+ - `require 'dry/monads'` doesn't load all monads anymore, use `require 'dry/monads/all'` instead or cherry pick them with `require 'dry/monads/maybe'` etc (timriley)
362
384
 
363
385
  [Compare v0.4.0...v1.0.0](https://github.com/dry-rb/dry-monads/compare/v0.4.0...v1.0.0)
364
386
 
@@ -366,16 +388,16 @@
366
388
 
367
389
  ## Changed
368
390
 
369
- * The `Either` monad was renamed to `Result` which sounds less nerdy but better reflects the purpose of the type. `Either::Right` became `Result::Success` and `Either::Left` became `Result::Failure`. This change is backward-compatible overall but you will see the new names when using old `Left` and `Right` methods (citizen428)
370
- * Consequently, `Try::Success` and `Try::Failure` were renamed to `Try::Value` and `Try::Error` (flash-gordon)
391
+ - The `Either` monad was renamed to `Result` which sounds less nerdy but better reflects the purpose of the type. `Either::Right` became `Result::Success` and `Either::Left` became `Result::Failure`. This change is backward-compatible overall but you will see the new names when using old `Left` and `Right` methods (citizen428)
392
+ - Consequently, `Try::Success` and `Try::Failure` were renamed to `Try::Value` and `Try::Error` (flash-gordon)
371
393
 
372
394
  ## Added
373
395
 
374
- * `Try#or`, works as `Result#or` (flash-gordon)
375
- * `Maybe#success?` and `Maybe#failure?` (aliases for `#some?` and `#none?`) (flash-gordon)
376
- * `Either#flip` inverts a `Result` value (flash-gordon)
377
- * `List#map` called without a block returns an `Enumerator` object (flash-gordon)
378
- * Right-biased monads (`Maybe`, `Result`, and `Try`) now implement the `===` operator which is used for equality checks in the `case` statement (flash-gordon)
396
+ - `Try#or`, works as `Result#or` (flash-gordon)
397
+ - `Maybe#success?` and `Maybe#failure?` (aliases for `#some?` and `#none?`) (flash-gordon)
398
+ - `Either#flip` inverts a `Result` value (flash-gordon)
399
+ - `List#map` called without a block returns an `Enumerator` object (flash-gordon)
400
+ - Right-biased monads (`Maybe`, `Result`, and `Try`) now implement the `===` operator which is used for equality checks in the `case` statement (flash-gordon)
379
401
  ```ruby
380
402
  case value
381
403
  when Some(1..100) then :ok
@@ -387,7 +409,7 @@
387
409
 
388
410
  ## Deprecated
389
411
 
390
- * Direct accessing `value` on right-biased monads has been deprecated, use the `value!` method instead. `value!` will raise an exception if it is called on a Failure/None/Error instance (flash-gordon)
412
+ - Direct accessing `value` on right-biased monads has been deprecated, use the `value!` method instead. `value!` will raise an exception if it is called on a Failure/None/Error instance (flash-gordon)
391
413
 
392
414
  [Compare v0.3.1...v0.4.0](https://github.com/dry-rb/dry-monads/compare/v0.3.1...v0.4.0)
393
415
 
@@ -395,20 +417,21 @@
395
417
 
396
418
  ## Fixed
397
419
 
398
- * Fixed unexpected coercing to `Hash` on `.bind` call (flash-gordon)
420
+ - Fixed unexpected coercing to `Hash` on `.bind` call (flash-gordon)
399
421
 
400
422
  [Compare v0.3.0...v0.3.1](https://github.com/dry-rb/dry-monads/compare/v0.3.0...v0.3.1)
401
423
 
402
424
  # v0.3.0 2017-03-16
403
425
 
404
426
  ## Added
405
- * Added `Either#either` that accepts two callbacks, runs the first if it is `Right` and the second otherwise (nkondratyev)
406
- * Added `#fmap2` and `#fmap3` for mapping over nested structures like `List Either` and `Either Some` (flash-gordon)
407
- * Added `Try#value_or` (dsounded)
408
- * Added the `List` monad which acts as an immutable `Array` and plays nice with other monads. A common example is a list of `Either`s (flash-gordon)
409
- * `#bind` made to work with keyword arguments as extra parameters to the block (flash-gordon)
410
- * Added `List#traverse` that "flips" the list with an embedded monad (flash-gordon + damncabbage)
411
- * Added `#tee` for all right-biased monads (flash-gordon)
427
+
428
+ - Added `Either#either` that accepts two callbacks, runs the first if it is `Right` and the second otherwise (nkondratyev)
429
+ - Added `#fmap2` and `#fmap3` for mapping over nested structures like `List Either` and `Either Some` (flash-gordon)
430
+ - Added `Try#value_or` (dsounded)
431
+ - Added the `List` monad which acts as an immutable `Array` and plays nice with other monads. A common example is a list of `Either`s (flash-gordon)
432
+ - `#bind` made to work with keyword arguments as extra parameters to the block (flash-gordon)
433
+ - Added `List#traverse` that "flips" the list with an embedded monad (flash-gordon + damncabbage)
434
+ - Added `#tee` for all right-biased monads (flash-gordon)
412
435
 
413
436
  [Compare v0.2.1...v0.3.0](https://github.com/dry-rb/dry-monads/compare/v0.2.1...v0.3.0)
414
437
 
@@ -416,12 +439,12 @@
416
439
 
417
440
  ## Added
418
441
 
419
- * Added `Either#tee` that is similar to `Object#tap` but executes the block only for `Right` instances (saverio-kantox)
442
+ - Added `Either#tee` that is similar to `Object#tap` but executes the block only for `Right` instances (saverio-kantox)
420
443
 
421
444
  ## Fixed
422
445
 
423
- * `Right(nil).to_maybe` now returns `None` with a warning instead of failing (orisaka)
424
- * `Some#value_or` doesn't require an argument because `None#value_or` doesn't require it either if a block was passed (flash-gordon)
446
+ - `Right(nil).to_maybe` now returns `None` with a warning instead of failing (orisaka)
447
+ - `Some#value_or` doesn't require an argument because `None#value_or` doesn't require it either if a block was passed (flash-gordon)
425
448
 
426
449
  [Compare v0.2.0...v0.2.1](https://github.com/dry-rb/dry-monads/compare/v0.2.0...v0.2.1)
427
450
 
@@ -429,8 +452,8 @@
429
452
 
430
453
  ## Added
431
454
 
432
- * Added `Maybe#to_json` as an opt-in extension for serialization to JSON (rocknruby)
433
- * Added `Maybe#value_or` which returns you the underlying value with a fallback in a single method call (dsounded)
455
+ - Added `Maybe#to_json` as an opt-in extension for serialization to JSON (rocknruby)
456
+ - Added `Maybe#value_or` which returns you the underlying value with a fallback in a single method call (dsounded)
434
457
 
435
458
  [Compare v0.1.1...v0.2.0](https://github.com/dry-rb/dry-monads/compare/v0.1.1...v0.2.0)
436
459
 
@@ -438,7 +461,7 @@
438
461
 
439
462
  ## Fixed
440
463
 
441
- * Added explicit requires of `dry-equalizer`. This allows to safely load only specific monads (artofhuman)
464
+ - Added explicit requires of `dry-equalizer`. This allows to safely load only specific monads (artofhuman)
442
465
 
443
466
  [Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-monads/compare/v0.1.0...v0.1.1)
444
467
 
@@ -446,11 +469,11 @@
446
469
 
447
470
  ## Added
448
471
 
449
- * Support for passing extra arguments to the block in `.bind` and `.fmap` (flash-gordon)
472
+ - Support for passing extra arguments to the block in `.bind` and `.fmap` (flash-gordon)
450
473
 
451
474
  ## Changed
452
475
 
453
- * Dropped MRI 2.0 support (flash-gordon)
476
+ - Dropped MRI 2.0 support (flash-gordon)
454
477
 
455
478
  [Compare v0.0.2...v0.1.0](https://github.com/dry-rb/dry-monads/compare/v0.0.2...v0.1.0)
456
479
 
@@ -458,8 +481,8 @@
458
481
 
459
482
  ## Added
460
483
 
461
- * Added `Either#to_either` so that you can rely on duck-typing when you work with different types of monads (timriley)
462
- * Added `Maybe#to_maybe` for consistency with `#to_either` (flash-gordon)
484
+ - Added `Either#to_either` so that you can rely on duck-typing when you work with different types of monads (timriley)
485
+ - Added `Maybe#to_maybe` for consistency with `#to_either` (flash-gordon)
463
486
 
464
487
  [Compare v0.0.1...v0.0.2](https://github.com/dry-rb/dry-monads/compare/v0.0.1...v0.0.2)
465
488
 
@@ -163,6 +163,10 @@ module Dry
163
163
  @trace = trace
164
164
  end
165
165
 
166
+ # @!method maybe(*args, &block)
167
+ # Alias of fmap, returns self back
168
+ alias_method :maybe, :fmap
169
+
166
170
  # If a block is given passes internal value to it and returns the result,
167
171
  # otherwise simply returns the parameter val.
168
172
  #
@@ -1,6 +1,6 @@
1
1
  module Dry
2
2
  module Monads
3
3
  # Gem version
4
- VERSION = '1.3.0'.freeze
4
+ VERSION = '1.3.1'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-monads
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Shilnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-03 00:00:00.000000000 Z
11
+ date: 2019-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-equalizer