🌐 REASONML PACT DIFFICULTY: Archmage Behavioral

Template Method in ReasonML

Functors enforcing an algorithmic skeleton.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Necromancy // Skeletal
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// REASON PATTERN //
module type Worker = {
  let preWork: unit => string;
  let postWork: unit => string;
};

module Algorithm = (W: Worker) => {
  let execute = () => {
    Js.log(W.preWork());
    Js.log("Doing core magic");
    Js.log(W.postWork());
  };
};

Functors provide the skeletal frame, requiring specific implementations of preWork and postWork while controlling the central orchestration logic.

Runic Tags: #reason #template-method #behavioral