-{-# OPTIONS -w #-}
--- The above warning supression flag is a temporary kludge.
--- While working on this module you are encouraged to remove it and fix
--- any warnings in the module. See
--- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
--- for details
-
- -- Deprecated:
- getUniqueUs, getUs, returnUs, thenUs, mapUs
+ -- Deprecated:
+ getUniqueUs, getUs, returnUs, thenUs, mapUs
%************************************************************************
A value of type @UniqSupply@ is unique, and it can
%************************************************************************
A value of type @UniqSupply@ is unique, and it can
\end{code}
\begin{code}
mkSplitUniqSupply :: Char -> IO UniqSupply
splitUniqSupply :: UniqSupply -> (UniqSupply, UniqSupply)
\end{code}
\begin{code}
mkSplitUniqSupply :: Char -> IO UniqSupply
splitUniqSupply :: UniqSupply -> (UniqSupply, UniqSupply)
- -- here comes THE MAGIC:
-
- -- This is one of the most hammered bits in the whole compiler
- mk_supply
- = unsafeDupableInterleaveIO (
- genSymZh >>= \ u_ -> case iUnbox u_ of { u -> (
- mk_supply >>= \ s1 ->
- mk_supply >>= \ s2 ->
- return (MkSplitUniqSupply (mask `bitOrFastInt` u) s1 s2)
- )})
+ -- here comes THE MAGIC:
+
+ -- This is one of the most hammered bits in the whole compiler
+ mk_supply
+ = unsafeDupableInterleaveIO (
+ genSymZh >>= \ u_ -> case iUnbox u_ of { u -> (
+ mk_supply >>= \ s1 ->
+ mk_supply >>= \ s2 ->
+ return (MkSplitUniqSupply (mask `bitOrFastInt` u) s1 s2)
+ )})
- (USM f) <*> (USM x) = USM $ \us -> case f us of
- (ff, us') -> case x us' of
+ (USM f) <*> (USM x) = USM $ \us -> case f us of
+ (ff, us') -> case x us' of
(xx, us'') -> (ff xx, us'')
-- the initUs function also returns the final UniqSupply; initUs_ drops it
(xx, us'') -> (ff xx, us'')
-- the initUs function also returns the final UniqSupply; initUs_ drops it
initUs init_us m = case unUSM m init_us of { (r,us) -> (r,us) }
initUs_ :: UniqSupply -> UniqSM a -> a
initUs init_us m = case unUSM m init_us of { (r,us) -> (r,us) }
initUs_ :: UniqSupply -> UniqSM a -> a
- = USM (\us -> case (expr us) of
- (result, us') -> unUSM (cont result) us')
+ = USM (\us -> case (expr us) of
+ (result, us') -> unUSM (cont result) us')
returnUs :: a -> UniqSM a
returnUs result = USM (\us -> (result, us))
returnUs :: a -> UniqSM a
returnUs result = USM (\us -> (result, us))
getUniqueM = liftM uniqFromSupply getUniqueSupplyM
getUniquesM = liftM uniqsFromSupply getUniqueSupplyM
getUniqueM = liftM uniqFromSupply getUniqueSupplyM
getUniquesM = liftM uniqsFromSupply getUniqueSupplyM
-{-# -- SPECIALIZE mapM :: (a -> UniqSM b) -> [a] -> UniqSM [b] #-}
-{-# -- SPECIALIZE mapAndUnzipM :: (a -> UniqSM (b,c)) -> [a] -> UniqSM ([b],[c]) #-}
-{-# -- SPECIALIZE mapAndUnzip3M :: (a -> UniqSM (b,c,d)) -> [a] -> UniqSM ([b],[c],[d]) #-}
+-- {-# SPECIALIZE mapM :: (a -> UniqSM b) -> [a] -> UniqSM [b] #-}
+-- {-# SPECIALIZE mapAndUnzipM :: (a -> UniqSM (b,c)) -> [a] -> UniqSM ([b],[c]) #-}
+-- {-# SPECIALIZE mapAndUnzip3M :: (a -> UniqSM (b,c,d)) -> [a] -> UniqSM ([b],[c],[d]) #-}