diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-04-20 16:15:44 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-05-29 11:58:45 -0400 |
commit | ec64624768735df24f1b6fe24a2b2e59172cc613 (patch) | |
tree | ad2a86f46427a701d3d604c01cd763ed52b205cd /compiler/GHC/Iface/Ext | |
parent | 42c611cffb2387627f80e790f1d175ebad7d9992 (diff) | |
download | haskell-ec64624768735df24f1b6fe24a2b2e59172cc613.tar.gz |
Use GHC's State monad consistently
GHC's internal State monad benefits from oneShot annotations on its
state, allowing for more aggressive eta expansion.
We currently don't have monad transformers with the same optimisation,
so we only change uses of the pure State monad here.
See #19657 and 19380.
Metric Decrease:
hie002
Diffstat (limited to 'compiler/GHC/Iface/Ext')
-rw-r--r-- | compiler/GHC/Iface/Ext/Utils.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/Iface/Ext/Utils.hs b/compiler/GHC/Iface/Ext/Utils.hs index 37252c43bc..20d047d150 100644 --- a/compiler/GHC/Iface/Ext/Utils.hs +++ b/compiler/GHC/Iface/Ext/Utils.hs @@ -40,7 +40,7 @@ import Data.Monoid import Data.List (find) import Data.Traversable ( for ) import Data.Coerce -import Control.Monad.Trans.State.Strict hiding (get) +import GHC.Utils.Monad.State.Strict hiding (get) import Control.Monad.Trans.Reader import qualified Data.Tree as Tree @@ -187,7 +187,7 @@ initialHTS = HTS emptyTypeMap IM.empty 0 freshTypeIndex :: State HieTypeState TypeIndex freshTypeIndex = do index <- gets freshIndex - modify' $ \hts -> hts { freshIndex = index+1 } + modify $ \hts -> hts { freshIndex = index+1 } return index compressTypes @@ -217,7 +217,7 @@ getTypeIndex t where extendHTS t ht = do i <- freshTypeIndex - modify' $ \(HTS tm tt fi) -> + modify $ \(HTS tm tt fi) -> HTS (extendTypeMap tm t i) (IM.insert i ht tt) fi return i |