Module
pooka/internal/map
src/pooka/internal/map.pookaThe storage cabinet keeps its Erlang map behind typed handles.
Capture a native immutable map in lookup, enumeration, size and update closures. Each change creates a new Storage with the same key/value types. This internal bridge avoids pretending that an untyped foreign map is an ordinary Pooka record.
map -> lookup / pairs / size / change capabilities
API reference
class Storage(k, v)
Internal typed access to a captured Erlang map. Public callers should use Dict or Set.
new(
lookup: fn(k) -> Option(v),
entries: fn() -> List(#(k, v)),
count: fn() -> Int,
change: fn(k, Option(v)) -> Storage(k, v)
)
fn(fn(k) -> Option(v), fn() -> List(#(k, v)), fn() -> Int, fn(k, Option(v)) -> pooka/internal/map.Storage(k, v)) -> pooka/internal/map.Storage(k, v)Create the value from its declared fields. Public factory functions keep the storage details out of ordinary calling code.
get(key: k) -> Option(v)
fn(k) -> Option(v)Use the captured lookup capability without exposing the map.
pairs() -> List(#(k, v))
fn() -> List(#(k, v))Enumerate captured map entries; order is unspecified.
size() -> Int
fn() -> IntRead the captured map size.
change(key: k, value: Option(v)) -> Storage(k, v)
fn(k, Option(v)) -> pooka/internal/map.Storage(k, v)Return new storage after insertion or deletion; None removes the key.
empty() -> Storage(k, v)
fn() -> pooka/internal/map.Storage(a, b)Create storage capabilities over an empty native map.
from_list(pairs: List(#(k, v))) -> Storage(k, v)
fn(List(#(a, b))) -> pooka/internal/map.Storage(a, b)Capture a native map made from pairs; later duplicate keys replace earlier values.