Module

pooka/internal/map

src/pooka/internal/map.pooka

The 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.

text
map -> lookup / pairs / size / change capabilities

API reference

class

Storage

src/pooka/internal/map.pooka:39
class Storage(k, v)

Internal typed access to a captured Erlang map. Public callers should use Dict or Set.

constructor

new

src/pooka/internal/map.pooka:47
new(
    lookup: fn(k) -> Option(v),
    entries: fn() -> List(#(k, v)),
    count: fn() -> Int,
    change: fn(k, Option(v)) -> Storage(k, v)
  )
INFERREDfn(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.

method

get

src/pooka/internal/map.pooka:60
get(key: k) -> Option(v)
INFERREDfn(k) -> Option(v)

Use the captured lookup capability without exposing the map.

method

pairs

src/pooka/internal/map.pooka:65
pairs() -> List(#(k, v))
INFERREDfn() -> List(#(k, v))

Enumerate captured map entries; order is unspecified.

method

size

src/pooka/internal/map.pooka:70
size() -> Int
INFERREDfn() -> Int

Read the captured map size.

method

change

src/pooka/internal/map.pooka:75
change(key: k, value: Option(v)) -> Storage(k, v)
INFERREDfn(k, Option(v)) -> pooka/internal/map.Storage(k, v)

Return new storage after insertion or deletion; None removes the key.

function

empty

src/pooka/internal/map.pooka:81
empty() -> Storage(k, v)
INFERREDfn() -> pooka/internal/map.Storage(a, b)

Create storage capabilities over an empty native map.

function

from_list

src/pooka/internal/map.pooka:89
from_list(pairs: List(#(k, v))) -> Storage(k, v)
INFERREDfn(List(#(a, b))) -> pooka/internal/map.Storage(a, b)

Capture a native map made from pairs; later duplicate keys replace earlier values.