{-# OPTIONS_GHC -fno-warn-missing-signatures #-} module Bug where import Hjugement -- | Decompress a 'Value'. expandValue :: Value a -> [a] expandValue (Value []) = [] expandValue (Value ((x,c):xs)) = replicate c x ++ expandValue (Value xs) data Grade = Null | Pass | Good deriving (Eq, Ord, Show, Bounded, Enum) (meritX,meritY) = (Merit (fromList [(Null,1),(Pass,71-50-3),(Good,15-3)]) ,Merit (fromList [(Null,7),(Pass,68-50-3),(Good,12-3)])) totX = let Merit x = meritX in sum x totY = let Merit x = meritY in sum x (mgX,mgY) = (majorityGauge meritX,majorityGauge meritY) (mvX,mvY) = (majorityValue meritX,majorityValue meritY) mgC = compare mgX mgY mvC = compare mvX mvY allX = expandValue (majorityValue meritX) allY = expandValue (majorityValue meritY) (simpX, simpY) = simpl allX allY simpl [] ys = ([], ys) simpl xs [] = (xs, []) simpl (x:xs) (y:ys) | x == y = simpl xs ys | otherwise = (xs, ys)