diff options
| author | krasimir <krasimir@chalmers.se> | 2008-10-19 16:38:56 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2008-10-19 16:38:56 +0000 |
| commit | 9837fb8fb17be9ecf5d90f3fb5a97ec6389f9eef (patch) | |
| tree | 72f9ac01d47b5ae6e690331040385bcf59ed37c0 /src/GF/Infra/UseIO.hs | |
| parent | a6c4747b112a3399ee3b7222766c266e4d34fa0a (diff) | |
move PGF.Quiz to GF.Quiz. It is not part of the PGF API
Diffstat (limited to 'src/GF/Infra/UseIO.hs')
| -rw-r--r-- | src/GF/Infra/UseIO.hs | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/GF/Infra/UseIO.hs b/src/GF/Infra/UseIO.hs index 0ca8d7456..b4cf48f1f 100644 --- a/src/GF/Infra/UseIO.hs +++ b/src/GF/Infra/UseIO.hs @@ -153,34 +153,6 @@ putStrFlush s = putStr s >> hFlush stdout putStrLnFlush :: String -> IO () putStrLnFlush s = putStrLn s >> hFlush stdout --- * a generic quiz session - -type QuestionsAndAnswers = [(String, String -> (Integer,String))] - -teachDialogue :: QuestionsAndAnswers -> String -> IO () -teachDialogue qas welc = do - putStrLn $ welc ++++ genericTeachWelcome - teach (0,0) qas - where - teach _ [] = do putStrLn "Sorry, ran out of problems" - teach (score,total) ((question,grade):quas) = do - putStr ("\n" ++ question ++ "\n> ") - answer <- getLine - if (answer == ".") then return () else do - let (result, feedback) = grade answer - score' = score + result - total' = total + 1 - putStr (feedback ++++ "Score" +++ show score' ++ "/" ++ show total') - if (total' > 9 && fromInteger score' / fromInteger total' >= 0.75) - then do putStrLn "\nCongratulations - you passed!" - else teach (score',total') quas - - genericTeachWelcome = - "The quiz is over when you have done at least 10 examples" ++++ - "with at least 75 % success." +++++ - "You can interrupt the quiz by entering a line consisting of a dot ('.').\n" - - -- * IO monad with error; adapted from state monad newtype IOE a = IOE (IO (Err a)) |
