~/bend-docscommunity

src/Reading.bend checks

raw source on the hub · import ber-core-store@0.1.2.0/src/Reading.bend as Reading

1 import
import Base

Types

type ChainEntry source · line 6 · raw

Data

Pure chain-reading cores; LAWS.bend quantifies over these, never over IO. Entries are a named Data constructor because a & pair defaults to kind Type, which List<&2, _> rejects.

Definitions

def encode_lookup_key source · line 10 · raw

@+namespace_name:String -> @+record_identifier:String -> String

Builds the "namespace/record" lookup key.

def pick_match source · line 14 · raw

@key_matches:Bool -> @stored_value:String -> @fallback:Maybe<&2, String> -> Maybe<&2, String>

Some on match, otherwise the recursive fallback.

def lookup_in_chain source · line 22 · raw

@+namespace_name:String -> @+record_identifier:String -> @ancestor_chain:List<&2, ChainEntry> -> Maybe<&2, String>

Most-recent-wins: the head of the chain is the newest commit.

def drop_tombstone source · line 32 · raw

@is_tombstone:Bool -> @stored_value:String -> Maybe<&2, String>

A tombstone reads as absent; any other value survives.

def resolve_tombstone source · line 40 · raw

@maybe_value:Maybe<&2, String> -> Maybe<&2, String>

Maps the TOMBSTONE sentinel to None.

def drop_or_keep source · line 48 · raw

@is_match:Bool -> @stored_key:String -> @stored_value:String -> @filtered_tail:List<&2, ChainEntry> -> List<&2, ChainEntry>

Drops the entry on match, keeps it otherwise.

def filter_entry source · line 56 · raw

@head_entry:ChainEntry -> @filtered_tail:List<&2, ChainEntry> -> @target_key:String -> List<&2, ChainEntry>

Removes the head entry when its key equals the target.

def remove_key_matches source · line 62 · raw

@+target_key:String -> @ancestor_chain:List<&2, ChainEntry> -> List<&2, ChainEntry>

Removes every entry whose key equals the target.

def attach_head source · line 70 · raw

@head_entry:ChainEntry -> @normalized_tail:List<&2, ChainEntry> -> List<&2, ChainEntry>

Keeps the head and drops its older duplicates from the normalized tail.

def normalize_chain source · line 76 · raw

@ancestor_chain:List<&2, ChainEntry> -> List<&2, ChainEntry>

Drops older duplicates, keeping the first (newest) occurrence of each key.

def make_entry source · line 84 · raw

@entry_key:String -> @entry_value:String -> ChainEntry

Shared vocabulary: other modules build ChainEntry through this constructor.

def entry_key_of source · line 88 · raw

@chain_entry:ChainEntry -> String

Projects the key out of an entry.

def entry_value_of source · line 94 · raw

@chain_entry:ChainEntry -> String

Projects the value out of an entry.