diff options
author | Bartosz Nitka <niteria@gmail.com> | 2016-05-11 07:47:47 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2016-05-11 07:47:50 -0700 |
commit | 3edbd091341ab0ab60862ba18d3107f34c7fc876 (patch) | |
tree | e5497ddfaf4e827549c4a02c6ae1d3453b83634f /compiler/typecheck/TcEvidence.hs | |
parent | 0e719885f53e20f2e14a94b32d858b47b516a8fc (diff) | |
download | haskell-3edbd091341ab0ab60862ba18d3107f34c7fc876.tar.gz |
Document SCC determinism
I've documented the guarantees that stronglyConnCompFromEdgedVertices
provides and commented on the call sites to explain why they are
OK from determinism standpoint. I've changed the functions to
nonDetUFM versions, so that it's explicit they could introduce
nondeterminism. I haven't defined container (VarSet, NameSet)
specific versions, so that we have less functions to worry about.
Test Plan: this is mostly just documentation,
it should have no runtime effect
Reviewers: bgamari, simonmar, austin, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2194
GHC Trac Issues: #4012
Diffstat (limited to 'compiler/typecheck/TcEvidence.hs')
-rw-r--r-- | compiler/typecheck/TcEvidence.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/typecheck/TcEvidence.hs index c4d02d8248..b86e3f4678 100644 --- a/compiler/typecheck/TcEvidence.hs +++ b/compiler/typecheck/TcEvidence.hs @@ -62,6 +62,7 @@ import Outputable import FastString import SrcLoc import Data.IORef( IORef ) +import UniqFM {- Note [TcCoercions] @@ -695,8 +696,11 @@ sccEvBinds bs = stronglyConnCompFromEdgedVertices edges mk_node :: EvBind -> (EvBind, EvVar, [EvVar]) mk_node b@(EvBind { eb_lhs = var, eb_rhs = term }) - = (b, var, varSetElems (evVarsOfTerm term `unionVarSet` - coVarsOfType (varType var))) + = (b, var, nonDetEltsUFM (evVarsOfTerm term `unionVarSet` + coVarsOfType (varType var))) + -- It's OK to use nonDetEltsUFM here as stronglyConnCompFromEdgedVertices + -- is still deterministic even if the edges are in nondeterministic order + -- as explained in Note [Deterministic SCC] in Digraph. evVarsOfCallStack :: EvCallStack -> VarSet evVarsOfCallStack cs = case cs of |