我刚接触Haskell,希望有人能帮忙!我试图让这个程序使用do while循环。
第二个getLine命令的结果会被放入变量goGlenn中,如果goGlenn不等于"start",则程序将返回到开头。
start = do
loop $ do lift performAction
putStrLn "Hello, what is your name?"
name <- getLine
putStrLn ("Welcome to our personality test " ++ name ++ ", inspired by the Big Five Theory.")
putStrLn "You will receive fifty questions in total to which you can reply with Yes or No."
putStrLn "Whenever you feel ready to begin please write Start"
goGlenn <- getLine
putStrLn goGlenn
while (goGlenn /= "start")
Control.Monad.LoopWhile
文档中改编而来的。 - chi