diff options
Diffstat (limited to 'src/Counter.hs')
-rw-r--r-- | src/Counter.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Counter.hs b/src/Counter.hs index 6646133..48429ef 100644 --- a/src/Counter.hs +++ b/src/Counter.hs @@ -1,4 +1,5 @@ module Counter( + Criteria, SenateCounter, createSenateCounter, @@ -22,9 +23,14 @@ import qualified Data.List as List -data SenateCounter = SenateCounter { prefData :: Vec.Store - , ballotMap :: Typ.BelowLineBallot - , numBallots :: Int } +-- represents a criteria used for finding ballots that voted a specific +-- way, for example voted for candidate C as #1, candidate F as #2, etc +type Criteria = [(Typ.Ranking,Typ.CandidateID)] + +data SenateCounter = SenateCounter + { prefData :: Vec.Store + , ballotMap :: Typ.BelowLineBallot + , numBallots :: Int } @@ -54,7 +60,7 @@ createSenateCounter f a b = do -doCount :: SenateCounter -> Typ.Criteria -> IO Int +doCount :: SenateCounter -> Criteria -> IO Int doCount sen criteria = do -- let isValidCriteria = all (\(x,y) -> y `List.elem` (ballotMap sen)) criteria |