The Adapter
A transmutation matrix allowing incompatible Gallina Wards to synchronize their leyline interfaces.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Rebinding
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
(* Gallina Ward: Adapter *)
Require Import String.
(* Old Ward Interface *)
Record LegacyWard := {
castLegacy : string -> string
}.
(* New Ward Interface *)
Record ModernWard := {
castModern : nat -> string
}.
(* The legacy ward in action *)
Definition ancientGlyph : LegacyWard := {|
castLegacy := fun s => "Casting " ++ s
|}.
(* The Adapter: translating modern numerical resonance to legacy string sigils *)
Definition wardAdapter (old : LegacyWard) (toString : nat -> string) : ModernWard := {|
castModern := fun n => old.(castLegacy) (toString n)
|}.
Runic Tags:
#adapter
#gallina
#wards