packages feed

HangmanAscii 0.1.1.2 → 0.1.1.3

raw patch · 2 files changed

+14/−11 lines, 2 files

Files

Game.hs view
@@ -80,17 +80,17 @@   | (fromList word) == valid = Won   | otherwise = Playing -stateLoop :: Session -> Game -> InputT IO Bool +stateLoop :: Session -> Game -> InputT IO (Maybe Bool) stateLoop s g = do   let st = status g   lift (printState s st g)   case st of-    GameOver -> outputStrLn "Game Over!" >> return False-    Won -> outputStrLn "You won !!!" >> return True+    GameOver -> outputStrLn "Game Over!" >> return  (Just False)+    Won -> outputStrLn "You won !!!" >> return (Just True)     Playing -> do       key <- getInputChar "Guess a character, a ~ z: "       case key of-        Nothing -> return False +        Nothing -> return Nothing         Just c -> stateLoop s (progress c g)  continue :: InputT IO Bool@@ -112,12 +112,15 @@ sessionLoop session cat words skill = do   w <- lift (randomPick words)   won <- stateLoop session (Game w cat skill empty empty)-  c <- continue-  case c of-    False -> return ()-    True -> do-      outputStrLn "\x1b[2A\x1b[0J"-      sessionLoop (updateSession won session) cat words skill+  case won of+    Nothing -> return ()+    Just yes -> do+      c <- continue+      case c of+        False -> return ()+        True -> do+          outputStrLn "\x1b[2A\x1b[0J"+          sessionLoop (updateSession yes session) cat words skill  hangman :: String -> [String] -> Skill -> IO () hangman cat words skill = do
HangmanAscii.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                HangmanAscii-version:             0.1.1.2+version:             0.1.1.3 synopsis:            Yet another Hangman game. description:                      Another command line implementation of the classic