✨ ARCANUM RUNE DIFFICULTY: Apprentice Structural

The Adapter

Convert the interface of an ancient spell into one expected by modern magical theories.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Spell Translation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
-- Ancient interface
structural type OldSpell = OldSpell (Text -> Nat)

ancientCast : OldSpell -> Text -> Nat
ancientCast s t = match s with
  OldSpell f -> f t
  
-- Modern interface
structural type NewSpell = NewSpell (Nat -> Boolean)

-- The Adapter
adaptSpell : OldSpell -> NewSpell
adaptSpell s = NewSpell (n -> (ancientCast s "mana") > n)

Ancient spells, written in lost dialects of the weave, often possess incompatible geometries with modern casting circles. The Adapter pattern wraps the old construct in a new, pure function. Unison’s type system ensures that this translation is sound and content-addressable, seamlessly integrating the ancient OldSpell into the NewSpell architecture.

Runic Tags: #structural #adapter #unison #functions