summaryrefslogtreecommitdiff
path: root/src/Counter.hs
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-01-14 14:05:02 +1100
committerJed Barber <jjbarber@y7mail.com>2017-01-14 14:05:02 +1100
commitb7bcf8a3377bc3b847234baaf24fe6e46d7f85b7 (patch)
tree580d54267de7ed4cc650c5d07345532699c803b1 /src/Counter.hs
parentcedc60f86a22eddef26d8db4cb3ec36d50a7fd75 (diff)
Some code/style cleanup
Diffstat (limited to 'src/Counter.hs')
-rw-r--r--src/Counter.hs14
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