🌐 REASONML PACT DIFFICULTY: Archmage Structural

Bridge in ReasonML

Separating abstraction from functor implementation.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Bridge
ARCANUM SCHOOL: Conjuration // Dimensional
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// REASON PATTERN //
module type Renderer = { let render: string => unit; };
module ConsoleRenderer: Renderer = { let render = Js.log; };

module Shape = (R: Renderer) => {
  let drawCircle = () => R.render("Circle");
};
module ConsoleShape = Shape(ConsoleRenderer);

Functors act as the ultimate Bridge, decoupling the abstract definition of shapes from the rendering engine dimensions.

Runic Tags: #reason #bridge #structural