⚙️ MIRANDA RUNE DIFFICULTY: Adept Behavioral

The Command of the Ancestral Monad

Encapsulating a pure invocation as an object within the Ancestral Monad.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Ancestral Monad
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MIRANDA PATTERN //
|| The Command pattern stores pure functions as executable invocations.

command ::= Cmd (num -> num)

execute :: command -> num -> num
execute (Cmd f) x = f x

inc_cmd :: command
inc_cmd = Cmd (\x -> x + 1)

dec_cmd :: command
dec_cmd = Cmd (\x -> x - 1)

run_commands :: [command] -> num -> num
run_commands [] val = val
run_commands (c:cs) val = run_commands cs (execute c val)
Runic Tags: #miranda #behavioral #command #ancestral-monad