X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FdeSugar%2FMatchCon.lhs;h=40943427e01581578035e7fa82c6bff8d814a0ef;hb=61bfd5dd3b9d70404d6f93c030a9bb1c402b9d31;hp=e828999c8af4a780fca1012ef9c64f97b15eb0e0;hpb=438596897ebbe25a07e1c82085cfbc5bdb00f09e;p=ghc-hetmet.git diff --git a/ghc/compiler/deSugar/MatchCon.lhs b/ghc/compiler/deSugar/MatchCon.lhs index e828999..4094342 100644 --- a/ghc/compiler/deSugar/MatchCon.lhs +++ b/ghc/compiler/deSugar/MatchCon.lhs @@ -1,4 +1,4 @@ -% + % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % \section[MatchCon]{Pattern-matching constructors} @@ -18,9 +18,8 @@ import DsUtils import Id ( Id ) import CoreSyn import Type ( mkTyVarTys ) -import Unique ( Uniquable(..), Unique ) -import UniqFM -- Until equivClassesUniq moves to Util -import Outputable +import ListSetOps ( equivClassesByUniq ) +import Unique ( Uniquable(..) ) \end{code} We are confronted with the first column of patterns in a set of @@ -121,21 +120,6 @@ match_con vars all_eqns@(EqnInfo n ctx (ConPat data_con _ ex_tvs ex_dicts arg_pa subst_it e = foldr subst_one e other_eqns subst_one (EqnInfo _ _ (ConPat _ _ ex_tvs' _ _ : _) _) e = mkTyApps (mkLams ex_tvs' e) ex_tys ex_tys = mkTyVarTys ex_tvs - - --- Belongs in Util.lhs -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) - where - add a ufm = addToUFM_C tack_on ufm (get_uniq a) [a] - tack_on old new = new++old \end{code} Note on @shift_con_pats@ just above: does what the list comprehension in