A three-state value type: :undefined, nil (null), or {:value, term}.
Similar to Option<T>, but distinguishes between a missing field (undefined)
and an explicitly null field. This is important for partial update semantics
where omitting a field means "don't change" and setting it to null means "clear".
JSON Serialization
:undefined→ field is omitted from JSON outputnil→null{:value, x}→ the JSON encoding ofx
Examples
iex> ACP.MaybeUndefined.is_undefined(:undefined)
true
iex> ACP.MaybeUndefined.is_undefined(nil)
false
iex> ACP.MaybeUndefined.is_undefined({:value, "hello"})
false
Summary
Functions
Converts to Option<Option<T>> equivalent: nil | {:some, nil} | {:some, value}.
Decodes a MaybeUndefined value from JSON deserialization.
Call with :missing if the key was not present, or the value if it was.
Converts from a nested option back to MaybeUndefined.
Returns true if the value is null.
Returns true if the value is undefined.
Returns true if the value contains a value.
Maps a function over the value, preserving undefined/null.
Encodes a MaybeUndefined value for JSON serialization.
Returns {:skip} for undefined (caller should omit the field),
nil for null, or the value itself.
Updates a target value if the MaybeUndefined is not undefined.
Returns the inner value, or nil if undefined or null.
Types
Functions
Converts to Option<Option<T>> equivalent: nil | {:some, nil} | {:some, value}.
Decodes a MaybeUndefined value from JSON deserialization.
Call with :missing if the key was not present, or the value if it was.
Converts from a nested option back to MaybeUndefined.
Returns true if the value is null.
Returns true if the value is undefined.
Returns true if the value contains a value.
Maps a function over the value, preserving undefined/null.
Encodes a MaybeUndefined value for JSON serialization.
Returns {:skip} for undefined (caller should omit the field),
nil for null, or the value itself.
Updates a target value if the MaybeUndefined is not undefined.
:undefined→ returns the current value unchangednil→ returns nil (clear){:value, v}→ returns v (set)
Returns the inner value, or nil if undefined or null.