λ HASKELL SIGILS DIFFICULTY: Adept Creational

The Builder

Assembling complex wards through pure composable state transformations.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Builder
ARCANUM SCHOOL: Transmutation // Abjuration
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PURE FUNCTIONAL VOID SIGIL //
module Builder where
import Control.Monad.State

data Golem = Golem { headType :: String, bodyType :: String } deriving Show
type GolemBuilder = State Golem ()

buildHead :: String -> GolemBuilder
buildHead h = modify (\g -> g { headType = h })

buildBody :: String -> GolemBuilder
buildBody b = modify (\g -> g { bodyType = b })
Runic Tags: #state-monad #builder #transmutation