View Source Funx.Monad.Maybe.Nothing (funx v0.1.0)
Represents the Nothing
variant of the Maybe
monad, used to model the absence of a value.
A Nothing
indicates that no value is present. All operations in the monad context simply propagate the absence, making Nothing
an identity for failure or emptiness.
This module implements the following protocols:
Funx.Monad
: Implementsbind/2
,map/2
, andap/2
, all of which returnNothing
.Funx.Foldable
: Providesfold_l/3
andfold_r/3
, invoking the fallback function when folding.Funx.Filterable
: Supports filtering operations, which always returnNothing
.Funx.Eq
: Enables equality checks betweenNothing
and otherMaybe
values.Funx.Ord
: Defines ordering behavior betweenNothing
andJust
.
These implementations ensure that Nothing
behaves consistently in functional composition, filtering, and comparison, treating absence as a stable and composable case.
Summary
Types
@type t() :: %Funx.Monad.Maybe.Nothing{}
Functions
@spec pure() :: t()
Creates a new Nothing
value.
Examples
iex> Funx.Monad.Maybe.Nothing.pure()
%Funx.Monad.Maybe.Nothing{}