Commit ea34f565 authored by niteria's avatar niteria Committed by Ben Gamari

Remove unused equivClassesByUniq

It uses `eltsUFM` so it can introduce nondeterminism, but it isn't used
so we can delete it.

Test Plan: it builds

Reviewers: simonpj, goldfire, simonmar, austin, bgamari

Reviewed By: austin, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012
parent a28611b1
......@@ -15,7 +15,7 @@ module ListSetOps (
-- Duplicate handling
hasNoDups, runs, removeDups, findDupsEq,
equivClasses, equivClassesByUniq,
-- Indexing
......@@ -24,8 +24,6 @@ module ListSetOps (
#include "HsVersions.h"
import Outputable
import Unique
import UniqFM
import Util
import Data.List
......@@ -159,16 +157,3 @@ findDupsEq _ [] = []
findDupsEq eq (x:xs) | null eq_xs = findDupsEq eq xs
| otherwise = (x:eq_xs) : findDupsEq eq neq_xs
where (eq_xs, neq_xs) = partition (eq x) xs
equivClassesByUniq :: (a -> Unique) -> [a] -> [[a]]
-- NB: it's *very* important that if we have the input list [a,b,c],
-- where a,b,c all have the same unique, then we get back the list
-- [a,b,c]
-- not
-- [c,b,a]
-- Hence the use of foldr, plus the reversed-args tack_on below
equivClassesByUniq get_uniq xs
= eltsUFM (foldr add emptyUFM xs)
add a ufm = addToUFM_C tack_on ufm (get_uniq a) [a]
tack_on old new = new++old
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment