✨ ARCANUM RUNE DIFFICULTY: Apprentice Creational

The Singleton of The Weave

Centralizing the magical leyline state using pure module-level constants.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Singleton
ARCANUM SCHOOL: Divination // Leylines
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
interface WeaveSingleton
    exposes [getTheWeave]
    imports []

Weave : {
    leylineEnergy : U64,
    activeNodes : U64
}

# In a pure language, a Singleton is often just a global constant
# or passed around explicitly as context.
theWeave : Weave
theWeave = {
    leylineEnergy: 999999,
    activeNodes: 12
}

getTheWeave : {} -> Weave
getTheWeave = \_ -> theWeave
Runic Tags: #fast-functional-wards #roc #singleton #constant