diff options
author | Bartosz Nitka <niteria@gmail.com> | 2016-06-14 03:28:30 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2016-06-23 07:53:12 -0700 |
commit | 35d1564cea2e611a4fecf24f09eff83f8a55af1c (patch) | |
tree | 5d46f89500052d356bf68e2befd6bf854550193a /compiler/rename/RnSource.hs | |
parent | 7fc20b02b20c97209b97f0e36d34a4ef40f537a4 (diff) | |
download | haskell-35d1564cea2e611a4fecf24f09eff83f8a55af1c.tar.gz |
Provide Uniquable version of SCC
We want to remove the `Ord Unique` instance because there's
no way to implement it in deterministic way and it's too
easy to use by accident.
We sometimes compute SCC for datatypes whose Ord instance
is implemented in terms of Unique. The Ord constraint on
SCC is just an artifact of some internal data structures.
We can have an alternative implementation with a data
structure that uses Uniquable instead.
This does exactly that and I'm pleased that I didn't have
to introduce any duplication to do that.
Test Plan:
./validate
I looked at performance tests and it's a tiny bit better.
Reviewers: bgamari, simonmar, ezyang, austin, goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2359
GHC Trac Issues: #4012
Diffstat (limited to 'compiler/rename/RnSource.hs')
-rw-r--r-- | compiler/rename/RnSource.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index 3b23bb602f..4790adad1f 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -49,7 +49,8 @@ import DynFlags import Util ( debugIsOn, partitionWith ) import HscTypes ( HscEnv, hsc_dflags ) import ListSetOps ( findDupsEq, removeDups, equivClasses ) -import Digraph ( SCC, flattenSCC, flattenSCCs, stronglyConnCompFromEdgedVertices ) +import Digraph ( SCC, flattenSCC, flattenSCCs + , stronglyConnCompFromEdgedVerticesUniq ) import UniqFM import qualified GHC.LanguageExtensions as LangExt @@ -1338,7 +1339,7 @@ depAnalTyClDecls :: GlobalRdrEnv -> [SCC (LTyClDecl Name)] -- See Note [Dependency analysis of type, class, and instance decls] depAnalTyClDecls rdr_env ds_w_fvs - = stronglyConnCompFromEdgedVertices edges + = stronglyConnCompFromEdgedVerticesUniq edges where edges = [ (d, tcdName (unLoc d), map (getParent rdr_env) (nonDetEltsUFM fvs)) | (d, fvs) <- ds_w_fvs ] |