… so I'm just going to post some fun Haskell code to give it a test drive:
prompt :: String -> IO (IO ())
prompt attribute = do
putStrLn ("What is your " ++ attribute ++ "?")
x <- getLine
return (putStrLn ("Your " ++ attribute ++ " is: " ++ x))
runWizard :: IO (IO a) -> IO a
runWizard request = do
respond <- request
respond
main :: IO ()
main = runWizard (foldMap prompt [ "name", "age", "favorite color", "sign" ])
In case you're wondering, this code snippet is from my The wizard monoid blog post