-module(carpenter@table@ordered_set). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([table/1, insert/3, lookup/2, delete/2]). -spec table(carpenter@internal@table_type@ordered_set:ordered_set(GAS, GAT)) -> carpenter@table:table(GAS, GAT). table(Set) -> _pipe = Set, table(_pipe). -spec insert( carpenter@internal@table_type@ordered_set:ordered_set(GAY, GAZ), GAY, GAZ ) -> carpenter@internal@table_type@ordered_set:ordered_set(GAY, GAZ). insert(Set, Key, Value) -> ets:insert( begin _pipe = erlang:element(2, Set), carpenter@table:name(_pipe) end, {Key, Value} ), Set. -spec lookup( carpenter@internal@table_type@ordered_set:ordered_set(GBE, GBF), GBE ) -> gleam@option:option(list({GBE, GBF})). lookup(Set, Key) -> case ets:lookup( begin _pipe = erlang:element(2, Set), carpenter@table:name(_pipe) end, Key ) of [] -> none; [_ | _] = Kv -> {some, Kv} end. -spec delete( carpenter@internal@table_type@ordered_set:ordered_set(GBK, GBL), GBK ) -> carpenter@internal@table_type@ordered_set:ordered_set(GBK, GBL). delete(Set, Key) -> ets:delete( begin _pipe = erlang:element(2, Set), carpenter@table:name(_pipe) end, Key ), Set.