Powered by AppSignal & Oban Pro

Funx.Monad.Either.Left

livebooks/monad/either/left.livemd

Funx.Monad.Either.Left

Mix.install([
  {:funx, "0.8.8"}
])

Overview

Represents the Left variant of the Either monad, used to model an error or failure.

This module implements the following protocols:

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

The Left monad propagates the wrapped error through operations without executing the success logic.

Function Examples

import Funx.Monad.Either.Left
alias Funx.Monad.Either.Left

Functions

pure/1

Creates a new Left value.

The pure/1 function wraps a value in the Left monad, representing an error or failure.

Examples

pure("error")