diff options
author | nineonine <mail4chemik@gmail.com> | 2019-10-11 00:31:58 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-11-19 11:53:16 -0500 |
commit | 88013b784d77c069b7c083244d04a59ac2da2895 (patch) | |
tree | 6053b9eb19acecb8c80b92ccd586cda36b71be90 /compiler/basicTypes | |
parent | cf7f8e5bbec83da1bb62075968bc78c86414c245 (diff) | |
download | haskell-88013b784d77c069b7c083244d04a59ac2da2895.tar.gz |
Optimize MonadUnique instances based on IO (#16843)
Metric Decrease:
T14683
Diffstat (limited to 'compiler/basicTypes')
-rw-r--r-- | compiler/basicTypes/UniqSupply.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/basicTypes/UniqSupply.hs b/compiler/basicTypes/UniqSupply.hs index 7e87315212..fb321454aa 100644 --- a/compiler/basicTypes/UniqSupply.hs +++ b/compiler/basicTypes/UniqSupply.hs @@ -18,7 +18,7 @@ module UniqSupply ( -- ** Operations on supplies uniqFromSupply, uniqsFromSupply, -- basic ops - takeUniqFromSupply, + takeUniqFromSupply, uniqFromMask, mkSplitUniqSupply, splitUniqSupply, listSplitUniqSupply, @@ -84,6 +84,11 @@ uniqsFromSupply :: UniqSupply -> [Unique] -- Infinite takeUniqFromSupply :: UniqSupply -> (Unique, UniqSupply) -- ^ Obtain the 'Unique' from this particular 'UniqSupply', and a new supply +uniqFromMask :: Char -> IO Unique +uniqFromMask mask + = do { uqNum <- genSym + ; return $! mkUnique mask uqNum } + mkSplitUniqSupply c = case ord c `shiftL` uNIQUE_BITS of !mask -> let |