Constructs a Validation whose value represents a failure.
Constructs a Validation whose value represents a failure.
See the documentation for the Validation structure to understand how to use this.
Tests if an arbitrary value is a Failure case of a Validation instance.
A textual representation of the Failure variant.
A textual representation of the Failure variant.
The constructor for this variant.
The container for instance methods for Failure variants of the Validation structure.
The tag for this variant, unique among the Validation variants.
The type for this variant, unique among Folktale data structures (and ideally unique among all unions in your application, as its used for type checking).
Performs a deep-comparison of two Validation values for equality.
Tests if an arbitrary value is a Validation instance.
True if the value is a Failure
instance.
Constructs a Validation holding a Success value.
Transforms a Validation into a Maybe. Failure values are lost in the process.
Transforms a Validation into a Reseult.
The value contained in an Failure instance of the Validation structure.
A textual representation for Validation instances.
A textual representation for Validation instances.
This method has been renamed to unsafeGet()
.
Extracts the value of a Validation structure, if it's a Success, otherwise returns the provided default value.
Returns the value inside of the Validation structure, regardless of its state.
Extracts the value from a Validation
structure.
Part of the Applicative instance for Fantasy Land 1.x. See the apply
method for details.
Part of the Applicative instance for Fantasy Land 2.x+. See the apply
method for details.
Part of the Bifunctor instance for Fantasy Land 2.x+. See the bimap
method for details.
Part of the Semigroup instance for Fantasy Land 2.x+. See the concat
method for details.
Part of the Setoid instance for Fantasy Land 2.x+. See the equals
method for details.
Part of the Functor instance for Fantasy Land 2.x+. See the map
method for details.
Part of the Applicative instance for Fantasy Land 2.x+. See the of
method for details.
Allows a function to provide functionality to variants in an union.
Applies a function to each case of a Validation.
Chooses and executes a function for each variant in the Validation structure.
Parses a JavaScript object previously serialised as aValidation.toJSON()
into a proper Validation structure.
Converts a Validation value to a JavaScript object that may be stored as a JSON value.
The constructor for this variant.
The variants in the Validation structure.
Transforms each side of a Validation with a function, without changing the status of the validation. That is, failures will still be failures, successes will still be successes.
Transforms the successful value inside a Validation structure with an unary function without changing the status of the validation. That is, Success values continue to be Success values, Failure values continue to be Failure values.
Transforms the failure value inside a Validation structure with an unary function without changing the status of the validation. That is, Success values continue to be Success values, Failure values continue to be Failure values.
Constructs a Validation whose value represents a failure.
Constructs a Validation whose value represents a success.
Failure(value) {
return { value };
}