Funx.Monad.Maybe.Nothing
Mix.install([
{:funx,
git: "https://github.com/JKWA/funx.git",
branch: "main"
}
])
Overview
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/3andfold_r/3, invoking the fallback function when folding. -
Funx.Filterable: Supports filtering operations, which always returnNothing. -
Funx.Eq: Enables equality checks betweenNothingand otherMaybevalues. -
Funx.Ord: Defines ordering behavior betweenNothingandJust.
These implementations ensure that Nothing behaves consistently in functional composition, filtering, and comparison, treating absence as a stable and composable case.
Function Examples
import Funx.Monad.Maybe.Nothing
alias Funx.Monad.Maybe.Nothing
Functions
pure/0
Creates a new Nothing value.
Examples
pure()