diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-04-20 16:43:30 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-04-26 11:46:17 -0400 |
commit | 0fdcb5133aaf2b82f93a333b787a271e99aa4359 (patch) | |
tree | d5afa20ec36260c419c55fd6b078808c48694a1e | |
parent | 2fd7d7eb5a08b95071e37dae5b403b2a2129ebf8 (diff) | |
download | haskell-wip/state-monad.tar.gz |
StgM: Use ReaderT rather than StateTwip/state-monad
-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 e8f4305151..34a26ca4b5 100644 --- a/compiler/GHC/Stg/Pipeline.hs +++ b/compiler/GHC/Stg/Pipeline.hs @@ -34,19 +34,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 |