import IOutilities(getCookedLine, trim) getYesNoSimple :: IO(String) getYesNoSimple = do putStr "Enter Yes or No: " response <- getCookedLine if response `elem` ["Yes", "No"] then return response else do putStr "Response not understood ... " getYesNoSimple tstynsimp = do response <- getYesNoSimple putStr("response = " ++ response) getListOfWords :: IO([String]) getListOfWords = getListOfWordsFramework firstPrompt getRestOfWords :: IO([String]) getRestOfWords = getListOfWordsFramework continuePrompt getListOfWordsFramework :: String -> IO([String]) getListOfWordsFramework prompt = do putStr prompt wRaw <- getCookedLine do let w = trim wRaw if w == "" then return [] else do ws <- getRestOfWords return([w] ++ ws) firstPrompt = "Enter List of Words\n" ++ " first word" ++ terminator continuePrompt = " next word" ++ terminator terminator = " (empty entry ends list): " tstlist = do ws <- getListOfWords (putStr . unwords) ws