combineTernaryXors :: [Clause] -> [Clause]
combineTernaryXors clauses = binXors
    where
        triXors = [ c | c <- clauses, isXor c, length (getVars c) == 3 ]

        xorGroups = map (map snd) (xorPairGroups triXors)
        xorGroups' = [ (head xg, tail xg) | xg <- xorGroups,
                                             length xg > 1 ]
        binXors = catMaybes [ (addXor xor xor') | (xor, xors) <- xorGroups',
                                                 xor' <- xors ]
combineTernaryXors :: [Clause] -> [Clause]
combineTernaryXors clauses = binXors
    where
        triXors = [ c | c <- clauses, isXor c, length (getVars c) == 3 ]

        xorGroups = map (map snd) (xorPairGroups triXors)
        xorGroups' = [ (head xg, tail xg) | xg <- xorGroups,
                                             length xg > 1 ]
        binXors = catMaybes [ (addXor xor xor') | (xor, xors) <- xorGroups',
                                                 xor' <- xors ]
combineTernaryXors clauses = binXors
    where
        triXors = [ c | c <- clauses, isXor c, length (getVars c) == 3 ]

        xorGroups = map (map snd) (xorPairGroups triXors)
        xorGroups' = [ (head xg, tail xg) | xg <- xorGroups,
                                             length xg > 1 ]
        binXors = catMaybes [ (addXor xor xor') | (xor, xors) <- xorGroups',
                                                 xor' <- xors ]