diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-04-20 16:43:30 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-05-29 11:58:52 -0400 |
commit | 21bdd9b74bd4fb190785b75b76e6d1f5ec0ba157 (patch) | |
tree | 50b409acbcd3fbe38137889d2cb6b16076f20bd1 /compiler/GHC | |
parent | ec64624768735df24f1b6fe24a2b2e59172cc613 (diff) | |
download | haskell-21bdd9b74bd4fb190785b75b76e6d1f5ec0ba157.tar.gz |
StgM: Use ReaderT rather than StateT
Diffstat (limited to 'compiler/GHC')
-rw-r--r-- | compiler/GHC/Stg/Pipeline.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/GHC/Stg/Pipeline.hs b/compiler/GHC/Stg/Pipeline.hs index 3a00a369e8..43f33d7fd8 100644 --- a/compiler/GHC/Stg/Pipeline.hs +++ b/compiler/GHC/Stg/Pipeline.hs @@ -32,19 +32,19 @@ import GHC.Utils.Panic import GHC.Utils.Logger import Control.Monad import Control.Monad.IO.Class -import GHC.Utils.Monad.State.Strict +import Control.Monad.Trans.Reader -newtype StgM a = StgM { _unStgM :: StateT Char IO a } +newtype StgM a = StgM { _unStgM :: ReaderT Char IO a } deriving (Functor, Applicative, Monad, MonadIO) instance MonadUnique StgM where - getUniqueSupplyM = StgM $ do { mask <- get + getUniqueSupplyM = StgM $ do { mask <- ask ; liftIO $! mkSplitUniqSupply mask} - getUniqueM = StgM $ do { mask <- get + getUniqueM = StgM $ do { mask <- ask ; liftIO $! uniqFromMask mask} runStgM :: Char -> StgM a -> IO a -runStgM mask (StgM m) = evalStateT m mask +runStgM mask (StgM m) = runReaderT m mask stg2stg :: Logger -> DynFlags -- includes spec of what stg-to-stg passes to do |