Lookup

org.sigilaris.core.application.support.compiletime.Lookup
See theLookup companion object
trait Lookup[S <: Tuple, Name0 <: String, K0, V0]

Evidence for looking up a table by name in a schema.

This typeclass provides compile-time schema lookup, extracting the key/value types and runtime table instance for a named table. This enables cross-module access where a reducer can depend on tables from other modules in the composed schema.

The Lookup instance carries the type information (K0, V0) as type parameters, and the table method returns a StateTable with those exact types preserved, enabling compile-time type-safe access with branded keys.

Type parameters

K0

the key type of the named table

Name

the table name to lookup (literal String type)

S

the schema tuple (tuple of Entry types)

V0

the value type of the named table

Attributes

Example
type Schema = Entry["accounts", Address, Account] *: Entry["balances", Address, BigInt] *: EmptyTuple
// Lookup evidence is automatically summoned
def useTable[F[_], S <: Tuple](tables: Tables[F, S])(using
 lookup: Lookup[S, "balances", Address, BigInt]
): Unit =
 val balancesTable = lookup.table(tables)
 // balancesTable has type StateTable[F] { type Name = "balances"; type K = Address; type V = BigInt }
 val key = balancesTable.brand(Address(123))  // Compiles: K is known to be Address
 balancesTable.get(key)  // Type-safe access
Companion
object
Source
Evidence.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def table[F[_]](tables: Tables[F, S]): StateTable[F] { type Name = Name0; type K = K0; type V = V0; }

Extract the concrete StateTable instance from a Tables tuple.

Extract the concrete StateTable instance from a Tables tuple.

The returned table has its Name, K, and V types precisely matching the type parameters of this Lookup instance, enabling compile-time type-safe operations with branded keys.

Type parameters

F

the effect type

Value parameters

tables

the tuple of StateTable instances corresponding to schema S

Attributes

Returns

the StateTable for the named table with exact types Name=Name0, K=K0, V=V0

Source
Evidence.scala