packages feed

Nomyx-Language 0.6.0 → 0.6.1

raw patch · 2 files changed

+22/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Language.Nomyx.Vote: callVote :: UTCTime -> Nomex ()
+ Language.Nomyx.Vote: singleVote :: UTCTime -> PlayerNumber -> Event (Maybe Bool)
+ Language.Nomyx.Vote: unanimity' :: [Maybe Bool] -> Bool
+ Language.Nomyx.Vote: vote :: UTCTime -> [PlayerNumber] -> Event Bool
+ Language.Nomyx.Vote: voteEvent :: UTCTime -> [PlayerNumber] -> Event ([Maybe Bool])

Files

Nomyx-Language.cabal view
@@ -1,5 +1,5 @@ name: Nomyx-Language-version: 0.6.0+version: 0.6.1 cabal-version: >=1.6 ---Warning: to use "cabal sdist", this patch is needed in cabal: https://github.com/haskell/cabal/pull/1110 ---This allows cabal to work with exported generated modules (Paths_Nomyx_Language)
src/Language/Nomyx/Vote.hs view
@@ -19,7 +19,8 @@ import Data.Typeable
 import Control.Monad.State hiding (forM_)
 import Data.Maybe-import Data.Time hiding (getCurrentTime)
+import Data.Time hiding (getCurrentTime)+import Data.Traversable hiding (mapM) import Control.Arrow
 import Control.Applicative
 import Data.List@@ -303,3 +304,22 @@          action $ _playerNumber pi       resolution [] = void $ outputAll_ "Result of elections: nobody won!"       resolution _  = throwError "Impossible result for elections"++voteEvent :: UTCTime -> [PlayerNumber] -> Event ([Maybe Bool])+voteEvent time pns = sequenceA $ map (singleVote time) pns++singleVote :: UTCTime -> PlayerNumber -> Event (Maybe Bool)+singleVote timeLimit pn = (Just <$> inputRadio pn "Vote for "[True, False] True) <|> (Nothing <$ timeEvent timeLimit)++vote :: UTCTime -> [PlayerNumber] -> Event Bool+vote timeLimit pns = unanimity' <$> (voteEvent timeLimit pns)++unanimity' :: [Maybe Bool] -> Bool+unanimity' = all (== Just True)++callVote :: UTCTime -> Nomex ()+callVote t = do+   pns <- liftEffect getAllPlayerNumbers+   void $ onEventOnce (vote t pns) (outputAll_ . show)++