Funx.Monad.Maybe.Just
Mix.install([
{:funx, "~> 0.1.5"}
])
Overview
Represents the Just
variant of the Maybe
monad, used to model the presence of a value.
A Just
wraps a single value and participates in functional composition by propagating the contained value through monadic operations.
This module implements the following protocols:
-
Funx.Monad
: Implementsbind/2
,map/2
, andap/2
for monadic composition. -
Funx.Foldable
: Providesfold_l/3
andfold_r/3
to fold over the wrapped value. -
Funx.Filterable
: Supports filtering withfilter/2
,filter_map/2
, andguard/2
. -
Funx.Eq
: Enables equality checks betweenJust
and otherMaybe
values. -
Funx.Ord
: Defines ordering behavior betweenJust
andNothing
.
These protocol implementations allow Just
to participate in structured computation, validation, filtering, and comparison within the Maybe
context.
Function Examples
import Funx.Monad.Maybe.Just
alias Funx.Monad.Maybe.Just
Functions
pure/1
Creates a new Just
value.
The pure/1
function wraps a value in the Just
monad, representing the presence of the value.
Examples
pure(5)
Raises
-
ArgumentError
ifnil
is provided.
# This will raise an ArgumentError
pure(nil)