⚙️ MIRANDA RUNE DIFFICULTY: Adept Creational

The Abstract Factory of the Ancestral Monad

Conjuring families of related pure functions without specifying their concrete implementations.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Abstract Factory
ARCANUM SCHOOL: Conjuration // Ancestral Monad
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MIRANDA PATTERN //
|| The Ancestral Monad dictates that all creations stem from pure origins.

abstract_factory ::= (num->string, bool->string)

make_factory_a :: abstract_factory
make_factory_a = (fa_num, fa_bool)
                 where
                   fa_num n = "A" ++ show n
                   fa_bool b = if b then "ATrue" else "AFalse"

make_factory_b :: abstract_factory
make_factory_b = (fb_num, fb_bool)
                 where
                   fb_num n = "B" ++ show n
                   fb_bool b = if b then "BTrue" else "BFalse"

client :: abstract_factory -> num -> bool -> string
client (f_num, f_bool) n b = f_num n ++ " and " ++ f_bool b
Runic Tags: #miranda #creational #abstract-factory #ancestral-monad