Constructs a Maybe value that represents a failure (a Nothing
).
Constructs a Maybe value that represents a failure (a Nothing
).
See the documentation for the Maybe structure to understand how to use this.
Tests if an arbitrary value is a Nothing case of a Maybe instance.
A textual representation of the Nothing variant.
A textual representation of the Nothing variant.
The constructor function for this variant.
The container for instance methods for Nothing variants of the Maybe structure.
The tag for this variant, unique among the Maybe 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).
Combines two maybes such that if they both have values (are a Just
) their values
are concatenated. Maybe values are expected to be Fantasy Land 1.x semigroups and
implement a concat
method.
Performs a deep-comparison of two Maybe values for equality. See adt/union/derivations/equality
for details.
Tests if an arbitrary value is a Maybe instance.
True if the value is a Nothing
instance.
A convenience method for the folktale/conversions/maybe-to-result
module.
A convenience method for the folktale/conversions/maybe-to-validation
module.
A textual representation for Maybe instances.
A textual representation for Maybe instances.
This method has been renamed to unsafeGet()
.
Extracts the value of a Maybe structure, if it exists (i.e.: is a Just
),
otherwise returns the provided default value.
Extracts the value from a Just
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 Monad instance for Fantasy Land 2.x+. See the chain
method for details.
Part of the Semigroup instance for Fantasy Land 2.x+. See the concat
method for details.
Part of the Monoid instance for Fantasy Land 2.x+. See the empty
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.
This method has been replaced by matchWith(pattern)
. cata
(morphism) selects
and executes a function for each variant of the Maybe structure.
Applies a function to each variant of the Maybe structure.
Chooses and executes a function for each variant in the Maybe structure.
Allows recovering from from failed Maybe values.
Parses a JavaScript object previously serialised as aMaybe.toJSON()
into a proper Maybe structure.
Converts a Maybe value to a JavaScript object that may be stored as a JSON value.
The constructor function for this variant.
The variants in the Maybe structure.
Transforms a Maybe value using a function contained in another Maybe. As with
.map()
, the Maybe values are expected to be Just
, and no operation is
performed if any of them is a Nothing
.
Transforms an entire Maybe structure with the provided function. As with
.map()
, the transformation is only applied if the value is a Just
, but
unlike .map()
the transformation is expected to return a new Maybe
value.
If the Maybe is a Just, passes its value to the predicate. If the predicate returns true, then the Maybe is returned unchanged. In every other case, a Nothing gets returned.
Transforms the value inside a Maybe structure with an unary function. Only
transforms values that are successful (Just
), and constructs a new Maybe as a
result.
Constructs a Maybe value that represents a successful value (a Just
).
Constructs a Maybe value that represents a failure (a Nothing
).
Nothing() {
}