[Git][ghc/ghc][master] compiler: Make OccSet opaque

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Jul 5 02:09:36 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
2304c697 by Ben Gamari at 2023-07-04T22:09:15-04:00
compiler: Make OccSet opaque

- - - - -


1 changed file:

- compiler/GHC/Types/Name/Occurrence.hs


Changes:

=====================================
compiler/GHC/Types/Name/Occurrence.hs
=====================================
@@ -809,7 +809,7 @@ forceOccEnv nf (MkOccEnv fs) = seqEltsUFM (seqEltsUFM nf) fs
 
 --------------------------------------------------------------------------------
 
-type OccSet = FastStringEnv (UniqSet NameSpace)
+newtype OccSet = OccSet (FastStringEnv (UniqSet NameSpace))
 
 emptyOccSet       :: OccSet
 unitOccSet        :: OccName -> OccSet
@@ -821,15 +821,15 @@ unionManyOccSets  :: [OccSet] -> OccSet
 elemOccSet        :: OccName -> OccSet -> Bool
 isEmptyOccSet     :: OccSet -> Bool
 
-emptyOccSet       = emptyFsEnv
-unitOccSet (OccName ns s) = unitFsEnv s (unitUniqSet ns)
+emptyOccSet       = OccSet emptyFsEnv
+unitOccSet (OccName ns s) = OccSet $ unitFsEnv s (unitUniqSet ns)
 mkOccSet          = extendOccSetList emptyOccSet
-extendOccSet      occs (OccName ns s) = extendFsEnv occs s (unitUniqSet ns)
-extendOccSetList  = foldl extendOccSet
-unionOccSets      = plusFsEnv_C unionUniqSets
+extendOccSet      (OccSet occs) (OccName ns s) = OccSet $ extendFsEnv occs s (unitUniqSet ns)
+extendOccSetList  = foldl' extendOccSet
+unionOccSets      (OccSet xs) (OccSet ys) = OccSet $ plusFsEnv_C unionUniqSets xs ys
 unionManyOccSets  = foldl' unionOccSets emptyOccSet
-elemOccSet (OccName ns s) occs = maybe False (elementOfUniqSet ns) $ lookupFsEnv occs s
-isEmptyOccSet     = isNullUFM
+elemOccSet (OccName ns s) (OccSet occs) = maybe False (elementOfUniqSet ns) $ lookupFsEnv occs s
+isEmptyOccSet     (OccSet occs) = isNullUFM occs
 
 {-
 ************************************************************************



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2304c6972fd485de335d1490008fc066055c81c3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2304c6972fd485de335d1490008fc066055c81c3
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230704/0a6769a4/attachment-0001.html>


More information about the ghc-commits mailing list