dry-monads 1.0.0 → 1.0.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: 4410c1810aef99efc8b163e7549ba09d744fd82d009f9eed7041ced4f2f3f386
4
- data.tar.gz: 88fa906421f3006f83a9d0e9daecfaa01fcbd6d698e3cc3b5be6282f2ef06597
3
+ metadata.gz: dae639cb8c6a7201b6486ed746ea0a07cdd34d39fb3df6565e84a76f4d135693
4
+ data.tar.gz: afd6150d91c54a90b8b69d3495e4f2408ab250a370b77e066a098eee24c1c100
5
5
  SHA512:
6
- metadata.gz: 8d008392f593b4aca09424032c6c56604cdc10de9b8e432d78559ad6c6e31fe5e4039ee285d5f7a5c18169dc31b5084649e8e234d7fbdc1eb20ac117b82ad671
7
- data.tar.gz: 0cbc3e1f45d51c1210064cf4009118cbdf91a85197d1b9157214fdbcfab5d839f777b2a35a268e90d4a448f29ab6c4dd0ee9109291dedb873a3be3546b6999da
6
+ metadata.gz: f4eaad835abb5e00b562651d8393a27310e2c6808c3109785d7352123758a7f2e3d54ac293d99c6f1e5ff928b38fc352f0ab6b7637e1399be5444073078528cc
7
+ data.tar.gz: e2ef0c0ed1a9c759293a09fe640cee08601b0a97f0b8e282f9edd71ce28987e895cd84acf6e2f65e4de58909a6121037378f936ad1f6e68e361df8563c9210d0
@@ -1,4 +1,19 @@
1
- # v1.0.0 to-be-released
1
+ # v1.0.1 2018-08-11
2
+
3
+ ## Fixed
4
+
5
+ * Fixed behavior of `List<Validated>#traverse` in presence of `Valid` values (flash-gordon + SunnyMagadan)
6
+
7
+ ## Added
8
+
9
+ * `to_proc` was added to value constructors (flash-gordon)
10
+ ```ruby
11
+ [1, 2, 3].map(&Some) # => [Some(1), Some(2), Some(3)]
12
+ ```
13
+
14
+ [Compare v1.0.0...v1.0.1](https://github.com/dry-rb/dry-monads/compare/v1.0.0...v1.0.1)
15
+
16
+ # v1.0.0 2018-06-26
2
17
 
3
18
  ## Added
4
19
 
@@ -128,7 +143,7 @@
128
143
  Failure(:invalid_name).trace # => app/operations/create_user.rb:43
129
144
  ```
130
145
 
131
- * `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 meningful as a result. There's also the `.discard` method for mapping any successful result (i.e. `Success(?)`, `Some(?)`, `Value(?)`, etc) to `Unit`.
146
+ * `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`.
132
147
 
133
148
  ```ruby
134
149
  # we're making an HTTP request but "forget" any successful result,
@@ -147,7 +162,7 @@
147
162
  * `Either#value` and `Maybe#value` were both droped, use `value_or` or `value!` when you :100: sure it's safe
148
163
  * `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)
149
164
 
150
- [Compare v0.4.0...v1.0.0](https://github.com/dry-rb/dry-monads/compare/v0.4.0...master)
165
+ [Compare v0.4.0...v1.0.0](https://github.com/dry-rb/dry-monads/compare/v0.4.0...v1.0.0)
151
166
 
152
167
  # v0.4.0 2017-11-11
153
168
 
@@ -37,6 +37,13 @@ module Dry
37
37
  def pure(value = Undefined, &block)
38
38
  Some.new(Undefined.default(value, block))
39
39
  end
40
+
41
+ # Reutrns a Some wrapper converted to a block
42
+ #
43
+ # @return [Proc]
44
+ def to_proc
45
+ @to_proc ||= method(:coerce).to_proc
46
+ end
40
47
  end
41
48
 
42
49
  # Returns true for an instance of a {Maybe::None} monad.
@@ -123,6 +123,13 @@ module Dry
123
123
  include RightBiased::Left
124
124
  include Dry::Equalizer(:failure)
125
125
 
126
+ # Returns a constructor proc
127
+ #
128
+ # @return [Proc]
129
+ def self.to_proc
130
+ @to_proc ||= method(:new).to_proc
131
+ end
132
+
126
133
  # Line where the value was constructed
127
134
  #
128
135
  # @return [String]
@@ -14,6 +14,15 @@ module Dry
14
14
  module Right
15
15
  include Dry::Core::Constants
16
16
 
17
+ # @private
18
+ def self.included(m)
19
+ super
20
+
21
+ def m.to_proc
22
+ @to_proc ||= method(:new).to_proc
23
+ end
24
+ end
25
+
17
26
  # Unwraps the underlying value
18
27
  #
19
28
  # @return [Object]
@@ -163,7 +163,10 @@ module Dry
163
163
  # @return [Validated::Invalid]
164
164
  #
165
165
  def apply(val = Undefined)
166
- Undefined.default(val) { yield }.alt_map { |v| @error + v }
166
+ Undefined.
167
+ default(val) { yield }.
168
+ alt_map { |v| @error + v }.
169
+ fmap { return self }
167
170
  end
168
171
 
169
172
  # Lifts a block/proc over Invalid
@@ -1,6 +1,6 @@
1
1
  module Dry
2
2
  module Monads
3
3
  # @private
4
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.0.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.0.0
4
+ version: 1.0.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: 2018-06-25 00:00:00.000000000 Z
11
+ date: 2018-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-equalizer