New paste Repaste Download
import System.Exit
isNameBlank :: String -> Bool
isNameBlank "" = False
isNameBlank _ = True
isNameAction :: Bool -> IO ()
isNameAction True = return ()
isNameAction False = main
listOfResponses :: String -> String
listOfResponses x =
  case x of
    "good" -> "That's great! Glad you're doing well."
    "bad"  -> "Aww! Hope you get better!"
    "alright" -> "okay! that's good you're doing alright"
    "okay" -> "oh, I see! that's good!"
    "ok"   -> "oh, I see! that's good!"
    _      -> "Answer the question, NOW!!!"
isResponseTrue :: String -> Bool
isResponseTrue x =
  case x of
    "good" -> True
    "bad"  -> True
    "alright" -> True
    "okay" -> True
    "ok"  -> True
    _     -> False
yesOrNoResponses :: String -> String
yesOrNoResponses x =
  case x of
    "yes" -> "Alright!"
    "no"  -> "Understandable. Have a good day!"
    _     -> "Answer. NOW!!!"
wannaFinish :: String -> IO ()
wannaFinish "yes" = return ()
wannaFinish "no"  = exitSuccess
wannaFinish _     = main
lastQuestion :: String -> String
lastQuestion x =
  case x of
    "milanesa" -> "I love those! especailly for breakfast. In Diners they call them Chicken Fried Steak."
    "enchiladas" -> "Enchiladas. Those are good! drenched in sauce... It's tasty!!"
    "torta"    -> "Can't beat a Torta! thats a sandwhich on steroids!!"
    "tacos"    -> "gotta love some good street tacos!"
    "chile rellenos" -> "oh, man! You've gotten the good stuff! Chile Rellenos are the bomb!"
    _  -> "you FAILED!"
lastQuestionTrue :: String -> Bool
lastQuestionTrue x =
  case x of
    "milanesa" -> True
    "enchiladas" -> True
    "torta"  -> True
    "tacos" -> True
    "chile rellenos" -> True
    _ -> False
main :: IO ()
main = do
  putStrLn "Please enter your name."
  name <- getLine
  putStrLn $ "hello, " ++ name ++ "! how are you doing?"
  isNameAction $ isNameBlank name
  answerOne <- getLine
  putStrLn $ listOfResponses answerOne
  isNameAction $ isResponseTrue answerOne
  putStrLn $ "Hey, " ++ name ++ ", wanna eat something?"
  foodAnswer <- getLine
  putStrLn $ yesOrNoResponses foodAnswer
  wannaFinish foodAnswer
  putStrLn $ "Alright, " ++ name ++ ". What do you wish to eat? We got Milanesa, Enchiladas, a Torta , Tacos, or Chile Rellenos. pick!"
  pickYourFood <- getLine
  putStrLn $ lastQuestion pickYourFood
  isNameAction $ lastQuestionTrue pickYourFood
  putStrLn "Have a great day!~"
  exitSuccess
Filename: potato.hs. Size: 2kb. View raw, , hex, or download this file.

This paste expires on 2026-04-21 05:22:20.180787+00:00. Pasted through v1-api.