Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module implements the composition of a Majority Judgment from a tree of Majority Judgments: for the same question, the same choices, the same judges and the same grades. In that tree, a parent judgment is formed by the aggregation of its children judgments, where a child judgment contributes only for a percentage of the parent judgment.
Synopsis
- data Section grade = Section {
- sectionShare :: Maybe Share
- sectionGrade :: Maybe grade
- type SectionByJudge judge grade = HashMap judge (Section grade)
- data SectionNode choice judge grade = SectionNode {
- sectionNodeShare :: Maybe Share
- sectionByJudgeByChoice :: HashMap choice (SectionByJudge judge grade)
- data ErrorSection choice judge grade
- = ErrorSection_unknown_choices (HashSet choice)
- | ErrorSection_unknown_judges (HashMap choice (HashSet judge))
- | ErrorSection_invalid_shares (HashMap choice (HashMap judge [Share]))
- opinionsBySection :: forall choice judge grade. Eq choice => Eq judge => Hashable choice => Hashable judge => Ord grade => Choices choice -> Judges judge grade -> Tree (SectionNode choice judge grade) -> Either (ErrorSection choice judge grade) (Tree (OpinionsByChoice choice judge grade))
Type Section
An opinion of a judge
about a choice
at a specific section Node
.
Section | |
|
Type SectionByJudge
type SectionByJudge judge grade = HashMap judge (Section grade) Source #
Type SectionNode
data SectionNode choice judge grade Source #
SectionNode | |
|
Instances
(Eq choice, Eq judge, Eq grade) => Eq (SectionNode choice judge grade) Source # | |
Defined in Majurity.Judgment.Section (==) :: SectionNode choice judge grade -> SectionNode choice judge grade -> Bool # (/=) :: SectionNode choice judge grade -> SectionNode choice judge grade -> Bool # | |
(Show choice, Show judge, Show grade) => Show (SectionNode choice judge grade) Source # | |
Defined in Majurity.Judgment.Section showsPrec :: Int -> SectionNode choice judge grade -> ShowS # show :: SectionNode choice judge grade -> String # showList :: [SectionNode choice judge grade] -> ShowS # |
Type ErrorSection
data ErrorSection choice judge grade Source #
ErrorSection_unknown_choices (HashSet choice) | When some |
ErrorSection_unknown_judges (HashMap choice (HashSet judge)) | When some |
ErrorSection_invalid_shares (HashMap choice (HashMap judge [Share])) | When at least one of the |
Instances
(Eq choice, Eq judge) => Eq (ErrorSection choice judge grade) Source # | |
Defined in Majurity.Judgment.Section (==) :: ErrorSection choice judge grade -> ErrorSection choice judge grade -> Bool # (/=) :: ErrorSection choice judge grade -> ErrorSection choice judge grade -> Bool # | |
(Show choice, Show judge) => Show (ErrorSection choice judge grade) Source # | |
Defined in Majurity.Judgment.Section showsPrec :: Int -> ErrorSection choice judge grade -> ShowS # show :: ErrorSection choice judge grade -> String # showList :: [ErrorSection choice judge grade] -> ShowS # |
opinionsBySection :: forall choice judge grade. Eq choice => Eq judge => Hashable choice => Hashable judge => Ord grade => Choices choice -> Judges judge grade -> Tree (SectionNode choice judge grade) -> Either (ErrorSection choice judge grade) (Tree (OpinionsByChoice choice judge grade)) Source #