The Command of Web Runes
Encapsulate a web rune invocation as an object, allowing logging and queuing.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Sealed Decrees
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PURESCRIPT PATTERN //
module Arcane.Command where
import Prelude
import Effect (Effect)
import Effect.Console (log)
import Data.Foldable (sequence_)
-- The Command is encapsulated as an Effect
type ArcaneCommand = Effect Unit
invokeLightning :: String -> ArcaneCommand
invokeLightning target = log $ "Lightning strikes " <> target
raiseDead :: Int -> ArcaneCommand
raiseDead count = log $ "Raising " <> show count <> " undead minions."
-- Invoker
executeRituals :: Array ArcaneCommand -> Effect Unit
executeRituals commands = do
log "Beginning the grand sequence..."
sequence_ commands
Runic Tags:
#behavioral
#command
#purescript
#runes