✨ ARCANUM RUNE DIFFICULTY: Apprentice Creational

The Prototype: Arcane Cloning

Duplicating existing enchantments and structures via deep, mathematically pure copies.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Replicant
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module Prototype

-- A record that can be cloned
record CloneableSoul where
  constructor MkSoul
  memoryCore : String
  powerLevel : Nat

interface Prototype p where
  clone : p -> p

Prototype CloneableSoul where
  -- In pure functional Idris, data is immutable, so cloning is trivial,
  -- but we can simulate divergence if desired.
  clone (MkSoul mc pl) = MkSoul mc pl

diverge : CloneableSoul -> CloneableSoul
diverge s = record { powerLevel = s.powerLevel + 1 } s

In the functional realms of Idris, the Prototype pattern takes on a spectral beauty. Since data is inherently immutable, an exact copy of a CloneableSoul costs nothing—it is a pure reference. However, the Theorem Proving Pacts allow for controlled divergence. The clone can be mutated via record updates to forge an entity that is identical in memory core but divergent in power, sidestepping the costly rituals of from-scratch conjuration.

Runic Tags: #creational #pure-functions #cloning