View Source Funx.Monad.Either.Right (funx v0.1.0)

Represents the Right variant of the Either monad, used to model a success or valid result.

This module implements the following protocols:

  • Funx.Eq: Defines equality checks between Right and other Either values.
  • Funx.Foldable: Provides fold_l/3 and fold_r/3 to handle folding for Right values.
  • Funx.Monad: Implements the bind/2, map/2, and ap/2 functions for monadic operations.
  • Funx.Ord: Defines ordering logic for Right and Left values.

The Right monad represents a valid result, and the contained value is propagated through operations.

Summary

Functions

Creates a new Right value.

Types

@type t(value) :: %Funx.Monad.Either.Right{right: value}

Functions

@spec pure(value) :: t(value) when value: term()

Creates a new Right value.

The pure/1 function wraps a value in the Right monad, representing a valid result.

Examples

iex> Funx.Monad.Either.Right.pure(5)
%Funx.Monad.Either.Right{right: 5}