⚙️ PURESCRIPT RUNE DIFFICULTY: Apprentice Structural

The Adapter of Web Runes

Translate the arcane API of ancient grimoires into modern CyberTablet interfaces.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Protocol Shifting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PURESCRIPT PATTERN //
module Arcane.Adapter where
import Prelude

-- Old API
type OldGrimoire = { readScroll :: String -> String }
dustyGrimoire :: OldGrimoire
dustyGrimoire = { readScroll: \spell -> "Reading ancient text: " <> spell }

-- New Expected API
type CyberTablet = { executeApp :: String -> String }

-- The Adapter
grimoireAdapter :: OldGrimoire -> CyberTablet
grimoireAdapter grimoire =
  { executeApp: \appId -> grimoire.readScroll ("App ID " <> appId <> " encoded in runes") }
Runic Tags: #structural #adapter #purescript #runes