[commit: ghc] master: Document why closeOverKind is OK for determinism (8669c48)

git at git.haskell.org git at git.haskell.org
Wed May 11 10:38:32 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8669c48d06ca260c13740e0bda97beea52d332fb/ghc

>---------------------------------------------------------------

commit 8669c48d06ca260c13740e0bda97beea52d332fb
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Wed May 11 03:39:25 2016 -0700

    Document why closeOverKind is OK for determinism
    
    There's no point in converting the existing call sites to use
    deterministic closeOverKinds if they never linearize the set.
    
    Test Plan: it compiles, this is basically just documentation
    
    Reviewers: simonpj, goldfire, simonmar, austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2191
    
    GHC Trac Issues: #4012


>---------------------------------------------------------------

8669c48d06ca260c13740e0bda97beea52d332fb
 compiler/types/TyCoRep.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index 4cdd883..0d95bd7 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -1513,7 +1513,9 @@ coVarsOfCos cos = mapUnionVarSet coVarsOfCo cos
 -- | Add the kind variables free in the kinds of the tyvars in the given set.
 -- Returns a non-deterministic set.
 closeOverKinds :: TyVarSet -> TyVarSet
-closeOverKinds = fvVarSet . closeOverKindsFV . varSetElems
+closeOverKinds = fvVarSet . closeOverKindsFV . nonDetEltsUFM
+  -- It's OK to use nonDetEltsUFM here because we immediately forget
+  -- about the ordering by returning a set.
 
 -- | Given a list of tyvars returns a deterministic FV computation that
 -- returns the given tyvars with the kind variables free in the kinds of the



More information about the ghc-commits mailing list