hjugement-2.0.0.20181030: Majority Judgment.

Safe HaskellNone
LanguageHaskell2010

Majority.Section

Contents

Description

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

Type Section

data Section grade Source #

An opinion of a judge about a choice at a specific section Node.

Constructors

Section 

Fields

Instances
Eq grade => Eq (Section grade) Source # 
Instance details

Defined in Majority.Section

Methods

(==) :: Section grade -> Section grade -> Bool #

(/=) :: Section grade -> Section grade -> Bool #

Show grade => Show (Section grade) Source # 
Instance details

Defined in Majority.Section

Methods

showsPrec :: Int -> Section grade -> ShowS #

show :: Section grade -> String #

showList :: [Section grade] -> ShowS #

Type SectionByJudge

type SectionByJudge judge grade = HashMap judge (Section grade) Source #

Type SectionNode

data SectionNode choice judge grade Source #

Node value of a Tree holding a Section, per judge, per choice.

Constructors

SectionNode 

Fields

Instances
(Eq choice, Eq judge, Eq grade) => Eq (SectionNode choice judge grade) Source # 
Instance details

Defined in Majority.Section

Methods

(==) :: 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 # 
Instance details

Defined in Majority.Section

Methods

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 #

Constructors

ErrorSection_unknown_choices (HashSet choice)

When some choices are not known.

ErrorSection_unknown_judges (HashMap choice (HashSet judge))

When some judges are not known.

ErrorSection_invalid_shares (HashMap choice (HashMap judge [Share]))

When at least one of the Shares is not positive, or when their sum is not 1.

Instances
(Eq choice, Eq judge) => Eq (ErrorSection choice judge grade) Source # 
Instance details

Defined in Majority.Section

Methods

(==) :: 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 # 
Instance details

Defined in Majority.Section

Methods

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 #

opinionsBySection cs js ss computes the Opinions of the given Judges js about the given choices cs, from the grade (specified or omitted) attributed to choices and the Shares (specified or omitted) attributed to Node in given Tree ss.