werewolf 0.3.3.1 → 0.3.3.2
raw patch · 3 files changed
+49/−1 lines, 3 files
Files
- CHANGELOG.md +4/−0
- app/Werewolf/Commands/Status.hs +43/−0
- werewolf.cabal +2/−1
CHANGELOG.md view
@@ -2,6 +2,10 @@ #### Upcoming +#### v0.3.3.2++* Fixed missing file in Cabal file. ([#18](https://github.com/hjwylde/werewolf/issues/18))+ #### v0.3.3.1 * Added `noIntersperse` to `interpret`. ([#60](https://github.com/hjwylde/werewolf/issues/60))
+ app/Werewolf/Commands/Status.hs view
@@ -0,0 +1,43 @@+{-|+Module : Werewolf.Commands.Status+Description : Handler for the status subcommand.++Copyright : (c) Henry J. Wylde, 2015+License : BSD3+Maintainer : public@hjwylde.com++Handler for the status subcommand.+-}++{-# LANGUAGE OverloadedStrings #-}++module Werewolf.Commands.Status (+ -- * Handle+ handle,+) where++import Control.Monad.Except+import Control.Monad.Extra+import Control.Monad.State+import Control.Monad.Writer++import Data.Text (Text)++import Game.Werewolf.Command+import Game.Werewolf.Engine hiding (isVillagersTurn)+import Game.Werewolf.Response++-- | Handle.+handle :: MonadIO m => Text -> m ()+handle callerName = do+ unlessM doesGameExist $ exitWith failure {+ messages = [privateMessage [callerName] "No game is running."]+ }++ game <- readGame++ let command = statusCommand callerName++ case runExcept (execWriterT $ execStateT (apply command) game) of+ Left errorMessages -> exitWith failure { messages = errorMessages }+ Right messages -> exitWith success { messages = messages }
werewolf.cabal view
@@ -1,5 +1,5 @@ name: werewolf-version: 0.3.3.1+version: 0.3.3.2 author: Henry J. Wylde maintainer: public@hjwylde.com@@ -34,6 +34,7 @@ Werewolf.Commands.Quit, Werewolf.Commands.See, Werewolf.Commands.Start,+ Werewolf.Commands.Status, Werewolf.Commands.Vote, Werewolf.Options, Werewolf.Version,