lib/dry/monads/validated.rb in dry-monads-1.4.0 vs lib/dry/monads/validated.rb in dry-monads-1.5.0
- old
+ new
@@ -1,11 +1,7 @@
# frozen_string_literal: true
-require "dry/monads/conversion_stubs"
-require "dry/monads/constants"
-require "dry/monads/right_biased"
-
module Dry
module Monads
# Validated is similar to Result and represents an outcome of a validation.
# The difference between Validated and Result is that the former implements
# `#apply` in a way that concatenates errors. This means that the error type
@@ -173,10 +169,10 @@
# @return [Validated::Invalid]
#
def apply(val = Undefined, &block)
Undefined
.default(val, &block)
- .alt_map { |v| @error + v }
+ .alt_map { @error + _1 }
.fmap { return self }
end
# Lifts a block/proc over Invalid
#