Safe Haskell | None |
---|
Voting system
- type AssessFunction = VoteStats -> Maybe Bool
- data VoteStats = VoteStats {
- voteCounts :: Map (Maybe Bool) Int
- nbParticipants :: Int
- voteFinished :: Bool
- unanimityVote :: Nomex ()
- callVoteRule :: AssessFunction -> NominalDiffTime -> RuleInfo -> Nomex ()
- callVoteRule' :: AssessFunction -> UTCTime -> RuleInfo -> Nomex ()
- callVote :: AssessFunction -> UTCTime -> String -> (Bool -> Nomex ()) -> Nomex ()
- voteWith :: UTCTime -> [PlayerNumber] -> AssessFunction -> String -> Event Bool
- voteEvents :: UTCTime -> String -> [PlayerNumber] -> [Event (Maybe Bool)]
- singleVote :: UTCTime -> String -> PlayerNumber -> Event (Maybe Bool)
- unanimity :: AssessFunction
- majority :: AssessFunction
- majorityWith :: Int -> AssessFunction
- numberVotes :: Int -> AssessFunction
- withQuorum :: AssessFunction -> Int -> AssessFunction
- getVoteStats :: Int -> [Maybe Bool] -> VoteStats
- counts :: (Eq a, Ord a) => [a] -> [(a, Int)]
- voteQuota :: Int -> VoteStats -> Maybe Bool
- nbVoters :: VoteStats -> Int
- totalVoters :: VoteStats -> Int
- notVoted :: VoteStats -> Int
- voted :: VoteStats -> Int
Documentation
type AssessFunction = VoteStats -> Maybe BoolSource
a vote assessing function (such as unanimity, majority...)
the vote statistics, including the number of votes per choice (Nothing means abstention), the number of persons called to vote, and if the vote if finished (timeout or everybody voted)
VoteStats | |
|
unanimityVote :: Nomex ()Source
vote at unanimity every incoming rule
callVoteRule :: AssessFunction -> NominalDiffTime -> RuleInfo -> Nomex ()Source
call a vote on a rule for every players, with an assessing function and a delay
callVoteRule' :: AssessFunction -> UTCTime -> RuleInfo -> Nomex ()Source
callVote :: AssessFunction -> UTCTime -> String -> (Bool -> Nomex ()) -> Nomex ()Source
call a vote for every players, with an assessing function, a delay and a function to run on the result
voteWith :: UTCTime -> [PlayerNumber] -> AssessFunction -> String -> Event BoolSource
voteEvents :: UTCTime -> String -> [PlayerNumber] -> [Event (Maybe Bool)]Source
singleVote :: UTCTime -> String -> PlayerNumber -> Event (Maybe Bool)Source
unanimity :: AssessFunctionSource
assess the vote results according to a unanimity
majority :: AssessFunctionSource
assess the vote results according to an absolute majority (half voters plus one)
majorityWith :: Int -> AssessFunctionSource
assess the vote results according to a majority of x (in %)
numberVotes :: Int -> AssessFunctionSource
assess the vote results according to a fixed number of positive votes
withQuorum :: AssessFunction -> Int -> AssessFunctionSource
adds a quorum to an assessing function
voteQuota :: Int -> VoteStats -> Maybe BoolSource
Compute a result based on a quota of positive votes. the result can be positive if the quota if reached, negative if the quota cannot be reached anymore at that point, or still pending.
nbVoters :: VoteStats -> IntSource
number of people that voted if the voting is finished, total number of people that should vote otherwise
totalVoters :: VoteStats -> IntSource