Chains a function that returns a Validation, enabling monadic composition.
For Passing
, applies the function; for Failing
, returns unchanged.
Function that takes a Passing
and returns a new Validation.
The Validation returned by fn
(for Passing
) or the same instance (for Failing
).
Combines this Validation with another, following semigroup rules.
Returns Passing
if both are Passing
, otherwise returns a Failing
with concatenated messages.
Another Validation to combine with.
A new Validation combining the states.
Transforms the Passing
value using a function, preserving the Validation structure.
Acts as a functor operation, similar to Array.map
. Failing
returns unchanged.
Function to transform the Passing
value.
A new Validation with the transformed value (for Passing
) or the same instance (for Failing
).
Matches the Validation state with a pattern, returning a value.
Enables declarative state handling, similar to a switch
statement.
Object with functions for each Validation state.
The result of the matching function.
Matches the Validation state with a partial pattern, performing side effects.
Partial object with functions for some Validation states.
Interface for Validation methods, implementing functor, monad, and semigroup operations.