| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
GHC.HsToCore.Monad
Contents
Synopsis
- type DsM = TcRnIf DsGblEnv DsLclEnv
- mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
- mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])
- initDs :: HscEnv -> TcGblEnv -> DsM a -> IO (Messages DsMessage, Maybe a)
- initDsTc :: DsM a -> TcM (Messages DsMessage, Maybe a)
- initTcDsForSolver :: TcM a -> DsM a
- initDsWithModGuts :: HscEnv -> ModGuts -> DsM a -> IO (Messages DsMessage, Maybe a)
- fixDs :: (a -> DsM a) -> DsM a
- foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
- whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl ()
- unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a
- xoptM :: Extension -> TcRnIf gbl lcl Bool
- class Functor f => Applicative (f :: Type -> Type) where
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- duplicateLocalDs :: Id -> DsM Id
- newSysLocalDs :: Mult -> Type -> DsM Id
- newSysLocalsDs :: [Scaled Type] -> DsM [Id]
- newUniqueId :: Id -> Mult -> Type -> DsM Id
- newFailLocalDs :: Mult -> Type -> DsM Id
- newPredVarDs :: PredType -> DsM Var
- getSrcSpanDs :: DsM SrcSpan
- putSrcSpanDs :: SrcSpan -> DsM a -> DsM a
- putSrcSpanDsA :: EpAnn ann -> DsM a -> DsM a
- mkNamePprCtxDs :: DsM NamePprCtx
- newUnique :: TcRnIf gbl lcl Unique
- data UniqSupply
- newUniqueSupply :: TcRnIf gbl lcl UniqSupply
- getGhcModeDs :: DsM GhcMode
- dsGetFamInstEnvs :: DsM FamInstEnvs
- dsLookupGlobal :: Name -> DsM TyThing
- dsLookupGlobalId :: Name -> DsM Id
- dsLookupTyCon :: Name -> DsM TyCon
- dsLookupDataCon :: Name -> DsM DataCon
- dsLookupConLike :: Name -> DsM ConLike
- getCCIndexDsM :: FastString -> DsM CostCentreIndex
- type DsMetaEnv = NameEnv DsMetaVal
- data DsMetaVal
- dsGetMetaEnv :: DsM (NameEnv DsMetaVal)
- dsLookupMetaEnv :: Name -> DsM (Maybe DsMetaVal)
- dsExtendMetaEnv :: DsMetaEnv -> DsM a -> DsM a
- getPmNablas :: DsM Nablas
- updPmNablas :: Nablas -> DsM a -> DsM a
- addUnspecables :: Set EvId -> DsM a -> DsM a
- getUnspecables :: DsM (Set EvId)
- dsGetCompleteMatches :: DsM CompleteMatches
- type DsWarning = (SrcSpan, SDoc)
- diagnosticDs :: DsMessage -> DsM ()
- errDsCoreExpr :: DsMessage -> DsM CoreExpr
- failWithDs :: DsMessage -> DsM a
- failDs :: DsM a
- discardWarningsDs :: DsM a -> DsM a
- addMessagesDs :: Messages DsMessage -> DsM ()
- captureMessagesDs :: DsM a -> DsM (Messages DsMessage, a)
- data DsMatchContext = DsMatchContext HsMatchContextRn SrcSpan
- data EquationInfo
- = EqnMatch {
- eqn_pat :: LPat GhcTc
- eqn_rest :: EquationInfo
- | EqnDone (MatchResult CoreExpr)
- = EqnMatch {
- type EquationInfoNE = EquationInfo
- prependPats :: [LPat GhcTc] -> EquationInfo -> EquationInfo
- mkEqnInfo :: [LPat GhcTc] -> MatchResult CoreExpr -> EquationInfo
- eqnMatchResult :: EquationInfo -> MatchResult CoreExpr
- data MatchResult a
- = MR_Infallible (DsM a)
- | MR_Fallible (CoreExpr -> DsM a)
- runMatchResult :: CoreExpr -> MatchResult a -> DsM a
- type DsWrapper = CoreExpr -> CoreExpr
- idDsWrapper :: DsWrapper
- pprRuntimeTrace :: String -> SDoc -> CoreExpr -> DsM CoreExpr
Documentation
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) #
mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c]) #
initTcDsForSolver :: TcM a -> DsM a Source #
unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a Source #
class Functor f => Applicative (f :: Type -> Type) where #
Instances
data UniqSupply Source #
Unique Supply
A value of type UniqSupply is unique, and it can
supply one distinct Unique. Also, from the supply, one can
also manufacture an arbitrary number of further UniqueSupply values,
which will be distinct from the first and from all others.
newUniqueSupply :: TcRnIf gbl lcl UniqSupply Source #
getCCIndexDsM :: FastString -> DsM CostCentreIndex Source #
See getCCIndexM.
getPmNablas :: DsM Nablas Source #
Get the current pattern match oracle state. See dsl_nablas.
updPmNablas :: Nablas -> DsM a -> DsM a Source #
Set the pattern match oracle state within the scope of the given action.
See dsl_nablas.
dsGetCompleteMatches :: DsM CompleteMatches Source #
The COMPLETE pragmas that are in scope.
diagnosticDs :: DsMessage -> DsM () Source #
Emit a diagnostic for the current source location. In case the diagnostic is a warning,
the latter will be ignored and discarded if the relevant WarningFlag is not set in the DynFlags.
See Note [Discarding Messages] in Error.
errDsCoreExpr :: DsMessage -> DsM CoreExpr Source #
Issue an error, but return the expression for (), so that we can continue reporting errors.
failWithDs :: DsMessage -> DsM a Source #
discardWarningsDs :: DsM a -> DsM a Source #
data DsMatchContext Source #
Constructors
| DsMatchContext HsMatchContextRn SrcSpan |
Instances
| Outputable DsMatchContext Source # | |
Defined in GHC.HsToCore.Monad Methods ppr :: DsMatchContext -> SDoc Source # | |
data EquationInfo Source #
Constructors
| EqnMatch | |
Fields
| |
| EqnDone (MatchResult CoreExpr) | What to do after match |
Instances
| Outputable EquationInfo Source # | |
Defined in GHC.HsToCore.Monad Methods ppr :: EquationInfo -> SDoc Source # | |
type EquationInfoNE = EquationInfo Source #
prependPats :: [LPat GhcTc] -> EquationInfo -> EquationInfo Source #
mkEqnInfo :: [LPat GhcTc] -> MatchResult CoreExpr -> EquationInfo Source #
data MatchResult a Source #
This is a value of type a with potentially a CoreExpr-shaped hole in it. This is used to deal with cases where we are potentially handling pattern match failure, and want to later specify how failure is handled.
Constructors
| MR_Infallible (DsM a) | We represent the case where there is no hole without a function from
|
| MR_Fallible (CoreExpr -> DsM a) |
Instances
| Applicative MatchResult Source # | Product is an "or" on fallibility---the combined match result is infallible only if the left and right argument match results both were. This is useful for combining a bunch of alternatives together and then
getting the overall fallibility of the entire group. See |
Defined in GHC.HsToCore.Monad Methods pure :: a -> MatchResult a # (<*>) :: MatchResult (a -> b) -> MatchResult a -> MatchResult b # liftA2 :: (a -> b -> c) -> MatchResult a -> MatchResult b -> MatchResult c # (*>) :: MatchResult a -> MatchResult b -> MatchResult b # (<*) :: MatchResult a -> MatchResult b -> MatchResult a # | |
| Functor MatchResult Source # | |
Defined in GHC.HsToCore.Monad Methods fmap :: (a -> b) -> MatchResult a -> MatchResult b # (<$) :: a -> MatchResult b -> MatchResult a # | |
runMatchResult :: CoreExpr -> MatchResult a -> DsM a Source #
Inject a trace message into the compiled program. Whereas pprTrace prints out information *while compiling*, pprRuntimeTrace captures that information and causes it to be printed *at runtime* using Debug.Trace.trace.
pprRuntimeTrace hdr doc expr
will produce an expression that looks like
trace (hdr + doc) expr
When using this to debug a module that Debug.Trace depends on, it is necessary to import {-# SOURCE #-} Debug.Trace () in that module. We could avoid this inconvenience by wiring in Debug.Trace.trace, but that doesn't seem worth the effort and maintenance cost.