GHC.Core.Opt.Simplify.Monad

ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Core.Opt.Simplify.Monad

Synopsis

- data TopEnvConfig = TopEnvConfig {
  - te_history_size :: !Int
  - te_tick_factor :: !Int
  }
- data SimplM result
- initSmpl :: Logger -> IO RuleEnv -> TopEnvConfig -> Int -> SimplM a -> IO (a, SimplCount)
- traceSmpl :: String -> SDoc -> SimplM ()
- getSimplRules :: SimplM RuleEnv
- class Monad m => MonadUnique (m :: Type -> Type) where
  - getUniqueSupplyM :: m UniqSupply
  - getUniqueM :: m Unique
  - getUniquesM :: m [Unique]
- newId :: FastString -> Mult -> Type -> SimplM Id
- newJoinId :: [Var] -> Type -> SimplM Id
- data SimplCount
- tick :: Tick -> SimplM ()
- freeTick :: Tick -> SimplM ()
- checkedTick :: Tick -> SimplM ()
- getSimplCount :: SimplM SimplCount
- zeroSimplCount :: Bool -> SimplCount
- pprSimplCount :: SimplCount -> SDoc
- plusSimplCount :: SimplCount -> SimplCount -> SimplCount
- isZeroSimplCount :: SimplCount -> Bool

# Documentation

data TopEnvConfig #

Constructors

TopEnvConfig |
Fields te_history_size :: !Int te_tick_factor :: !Int

data SimplM result #

#### Instances

Instances details

MonadIO SimplM # |
Instance details Defined in GHC.Core.Opt.Simplify.Monad Methods liftIO :: IO a -> SimplM a #
Applicative SimplM # |
Instance details Defined in GHC.Core.Opt.Simplify.Monad Methods pure :: a -> SimplM a # (<*>) :: SimplM (a -> b) -> SimplM a -> SimplM b # liftA2 :: (a -> b -> c) -> SimplM a -> SimplM b -> SimplM c # (*>) :: SimplM a -> SimplM b -> SimplM b # (<*) :: SimplM a -> SimplM b -> SimplM a #
Functor SimplM # |
Instance details Defined in GHC.Core.Opt.Simplify.Monad Methods fmap :: (a -> b) -> SimplM a -> SimplM b # (<$) :: a -> SimplM b -> SimplM a #
Monad SimplM # |
Instance details Defined in GHC.Core.Opt.Simplify.Monad Methods (>>=) :: SimplM a -> (a -> SimplM b) -> SimplM b # (>>) :: SimplM a -> SimplM b -> SimplM b # return :: a -> SimplM a #
MonadUnique SimplM # |
Instance details Defined in GHC.Core.Opt.Simplify.Monad Methods getUniqueSupplyM :: SimplM UniqSupply # getUniqueM :: SimplM Unique # getUniquesM :: SimplM [Unique] #
HasLogger SimplM # |
Instance details Defined in GHC.Core.Opt.Simplify.Monad Methods getLogger :: SimplM Logger #

initSmpl #

Arguments

:: Logger |
-> IO RuleEnv |
-> TopEnvConfig |
-> Int | Size of the bindings, used to limit the number of ticks we allow
-> SimplM a |
-> IO (a, SimplCount) |

traceSmpl :: String -> SDoc -> SimplM () #

getSimplRules :: SimplM RuleEnv #

class Monad m => MonadUnique (m :: Type -> Type) where #

A monad for generating unique identifiers

Minimal complete definition

getUniqueSupplyM

Methods

getUniqueSupplyM :: m UniqSupply #

Get a new UniqueSupply

getUniqueM :: m Unique #

Get a new unique identifier

getUniquesM :: m [Unique] #

Get an infinite list of new unique identifiers

#### Instances

Instances details

MonadUnique CoreM # |
Instance details Defined in GHC.Core.Opt.Monad Methods getUniqueSupplyM :: CoreM UniqSupply # getUniqueM :: CoreM Unique # getUniquesM :: CoreM [Unique] #
MonadUnique SimplM # |
Instance details Defined in GHC.Core.Opt.Simplify.Monad Methods getUniqueSupplyM :: SimplM UniqSupply # getUniqueM :: SimplM Unique # getUniquesM :: SimplM [Unique] #
MonadUnique UniqSM # |
Instance details Defined in GHC.Types.Unique.Supply Methods getUniqueSupplyM :: UniqSM UniqSupply # getUniqueM :: UniqSM Unique # getUniquesM :: UniqSM [Unique] #

newId :: FastString -> Mult -> Type -> SimplM Id #

newJoinId :: [Var] -> Type -> SimplM Id #

Make a join id with given type and arity but without call-by-value annotations.

data SimplCount #

tick :: Tick -> SimplM () #

freeTick :: Tick -> SimplM () #

checkedTick :: Tick -> SimplM () #

getSimplCount :: SimplM SimplCount #

zeroSimplCount #

Arguments

:: Bool | ddump-simpl-stats
-> SimplCount |

pprSimplCount :: SimplCount -> SDoc #

plusSimplCount :: SimplCount -> SimplCount -> SimplCount #

isZeroSimplCount :: SimplCount -> Bool #