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: Implements bind/2, map/2, and ap/2, all of which return Nothing.
  • Funx.Foldable: Provides fold_l/3 and fold_r/3, invoking the fallback function when folding.
  • Funx.Filterable: Supports filtering operations, which always return Nothing.
  • Funx.Eq: Enables equality checks between Nothing and other Maybe values.
  • Funx.Ord: Defines ordering behavior between Nothing and Just.

These implementations ensure that Nothing behaves consistently in functional composition, filtering, and comparison, treating absence as a stable and composable case.

Summary

Functions

Creates a new Nothing value.

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{}