-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Set breakpoints using a GHC plugin -- -- A plugin that allows you to set breakpoints for debugging purposes. @package breakpoint @version 0.1.3.0 module Debug.Breakpoint.GhcFacade -- | Monads having fixed points with a 'knot-tying' semantics. Instances of -- MonadFix should satisfy the following laws: -- --
-- (<*>) = liftA2 id ---- --
-- liftA2 f x y = f <$> x <*> y ---- -- Further, any definition must satisfy the following: -- --
pure id <*> v = -- v
pure (.) <*> u -- <*> v <*> w = u <*> (v -- <*> w)
pure f <*> -- pure x = pure (f x)
u <*> pure y = -- pure ($ y) <*> u
-- forall x y. p (q x y) = f x . g y ---- -- it follows from the above that -- --
-- liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v ---- -- If f is also a Monad, it should satisfy -- -- -- -- (which implies that pure and <*> satisfy the -- applicative functor laws). class Functor f => Applicative (f :: Type -> Type) -- | Lift a value. pure :: Applicative f => a -> f a -- | Sequential application. -- -- A few functors support an implementation of <*> that is -- more efficient than the default one. -- --
-- >>> data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
--
--
-- -- >>> produceFoo :: Applicative f => f Foo ---- --
-- >>> produceBar :: Applicative f => f Bar -- -- >>> produceBaz :: Applicative f => f Baz ---- --
-- >>> mkState :: Applicative f => f MyState -- -- >>> mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz --(<*>) :: Applicative f => f (a -> b) -> f a -> f b -- | Lift a binary function to actions. -- -- Some functors support an implementation of liftA2 that is more -- efficient than the default one. In particular, if fmap is an -- expensive operation, it is likely better to use liftA2 than to -- fmap over the structure and then use <*>. -- -- This became a typeclass method in 4.10.0.0. Prior to that, it was a -- function defined in terms of <*> and fmap. -- --
-- >>> liftA2 (,) (Just 3) (Just 5) -- Just (3,5) --liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c -- | Sequence actions, discarding the value of the first argument. -- --
-- >>> Just 2 *> Just 3 -- Just 3 ---- --
-- >>> Nothing *> Just 3 -- Nothing ---- -- Of course a more interesting use case would be to have effectful -- computations instead of just returning pure values. -- --
-- >>> import Data.Char
--
-- >>> import Text.ParserCombinators.ReadP
--
-- >>> let p = string "my name is " *> munch1 isAlpha <* eof
--
-- >>> readP_to_S p "my name is Simon"
-- [("Simon","")]
--
(*>) :: Applicative f => f a -> f b -> f b
-- | Sequence actions, discarding the value of the second argument.
(<*) :: Applicative f => f a -> f b -> f a
infixl 4 <*
infixl 4 *>
infixl 4 <*>
-- | Plugin is the compiler plugin data type. Try to avoid
-- constructing one of these directly, and just modify some fields of
-- defaultPlugin instead: this is to try and preserve source-code
-- compatibility when we add fields to this.
--
-- Nonetheless, this API is preliminary and highly likely to change in
-- the future.
data Plugin
Plugin :: CorePlugin -> TcPlugin -> HoleFitPlugin -> ([CommandLineOption] -> HscEnv -> IO HscEnv) -> ([CommandLineOption] -> IO PluginRecompile) -> ([CommandLineOption] -> ModSummary -> HsParsedModule -> Hsc HsParsedModule) -> ([CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)) -> ([CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv) -> ([CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc)) -> (forall lcl. () => [CommandLineOption] -> ModIface -> IfM lcl ModIface) -> Plugin
-- | Modify the Core pipeline that will be used for compilation. This is
-- called as the Core pipeline is built for every module being compiled,
-- and plugins get the opportunity to modify the pipeline in a
-- nondeterministic order.
[installCoreToDos] :: Plugin -> CorePlugin
-- | An optional typechecker plugin, which may modify the behaviour of the
-- constraint solver.
[tcPlugin] :: Plugin -> TcPlugin
-- | An optional plugin to handle hole fits, which may re-order or change
-- the list of valid hole fits and refinement hole fits.
[holeFitPlugin] :: Plugin -> HoleFitPlugin
-- | An optional plugin to update HscEnv, right after plugin
-- loading. This can be used to register hooks or tweak any field of
-- DynFlags before doing actual work on a module.
[driverPlugin] :: Plugin -> [CommandLineOption] -> HscEnv -> IO HscEnv
-- | Specify how the plugin should affect recompilation.
[pluginRecompile] :: Plugin -> [CommandLineOption] -> IO PluginRecompile
-- | Modify the module when it is parsed. This is called by
-- GHC.Driver.Main when the parsing is successful.
[parsedResultAction] :: Plugin -> [CommandLineOption] -> ModSummary -> HsParsedModule -> Hsc HsParsedModule
-- | Modify each group after it is renamed. This is called after each
-- HsGroup has been renamed.
[renamedResultAction] :: Plugin -> [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn)
-- | Modify the module when it is type checked. This is called at the very
-- end of typechecking.
[typeCheckResultAction] :: Plugin -> [CommandLineOption] -> ModSummary -> TcGblEnv -> TcM TcGblEnv
-- | Modify the TH splice or quasiqoute before it is run.
[spliceRunAction] :: Plugin -> [CommandLineOption] -> LHsExpr GhcTc -> TcM (LHsExpr GhcTc)
-- | Modify an interface that have been loaded. This is called by
-- GHC.Iface.Load when an interface is successfully loaded. Not
-- applied to the loading of the plugin interface. Tools that rely on
-- information from modules other than the currently compiled one should
-- implement this function.
[interfaceLoadAction] :: Plugin -> forall lcl. () => [CommandLineOption] -> ModIface -> IfM lcl ModIface
data FrontendPlugin
FrontendPlugin :: FrontendPluginAction -> FrontendPlugin
[frontend] :: FrontendPlugin -> FrontendPluginAction
-- | Monads in which IO computations may be embedded. Any monad
-- built by applying a sequence of monad transformers to the IO
-- monad will be an instance of this class.
--
-- Instances should satisfy the following laws, which state that
-- liftIO is a transformer of monads:
--
--
class Monad m => MonadIO (m :: Type -> Type)
-- | Lift a computation from the IO monad. This allows us to run IO
-- computations in any monadic stack, so long as it supports these kinds
-- of operations (i.e. IO is the base monad for the stack).
--
-- -- import Control.Monad.Trans.State -- from the "transformers" library -- -- printState :: Show s => StateT s IO () -- printState = do -- state <- get -- liftIO $ print state ---- -- Had we omitted liftIO, we would have ended up with -- this error: -- --
-- • Couldn't match type ‘IO’ with ‘StateT s IO’ -- Expected type: StateT s IO () -- Actual type: IO () ---- -- The important part here is the mismatch between StateT s IO -- () and IO (). -- -- Luckily, we know of a function that takes an IO a and -- returns an (m a): liftIO, enabling us to run -- the program and see the expected results: -- --
-- > evalStateT printState "hello" -- "hello" -- -- > evalStateT printState 3 -- 3 --liftIO :: MonadIO m => IO a -> m a -- | The mapAndUnzipM function maps its first argument over a list, -- returning the result as a pair of lists. This function is mainly used -- with complicated data structures or a state monad. mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c]) -- | A mutable variable in the IO monad data IORef a -- | Right-to-left monadic fold over the elements of a structure. -- -- Given a structure t with elements (a, b, c, ..., x, -- y), the result of a fold with an operator function f is -- equivalent to: -- --
-- foldrM f z t = do -- yy <- f y z -- xx <- f x yy -- ... -- bb <- f b cc -- aa <- f a bb -- return aa -- Just @return z@ when the structure is empty ---- -- For a Monad m, given two functions f1 :: a -> m b -- and f2 :: b -> m c, their Kleisli composition (f1 -- >=> f2) :: a -> m c is defined by: -- --
-- (f1 >=> f2) a = f1 a >>= f2 ---- -- Another way of thinking about foldrM is that it amounts to an -- application to z of a Kleisli composition: -- --
-- foldrM f z t = f y >=> f x >=> ... >=> f b >=> f a $ z ---- -- The monadic effects of foldrM are sequenced from right to -- left, and e.g. folds of infinite lists will diverge. -- -- If at some step the bind operator (>>=) -- short-circuits (as with, e.g., mzero in a MonadPlus), -- the evaluated effects will be from a tail of the element sequence. If -- you want to evaluate the monadic effects in left-to-right order, or -- perhaps be able to short-circuit after an initial sequence of -- elements, you'll need to use foldlM instead. -- -- If the monadic effects don't short-circuit, the outermost application -- of f is to the leftmost element a, so that, ignoring -- effects, the result looks like a right fold: -- --
-- a `f` (b `f` (c `f` (... (x `f` (y `f` z))))). ---- --
-- >>> let f i acc = do { print i ; return $ i : acc }
--
-- >>> foldrM f [] [0..3]
-- 3
-- 2
-- 1
-- 0
-- [0,1,2,3]
--
foldrM :: (Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b
-- | Left-to-right monadic fold over the elements of a structure.
--
-- Given a structure t with elements (a, b, ..., w, x,
-- y), the result of a fold with an operator function f is
-- equivalent to:
--
-- -- foldlM f z t = do -- aa <- f z a -- bb <- f aa b -- ... -- xx <- f ww x -- yy <- f xx y -- return yy -- Just @return z@ when the structure is empty ---- -- For a Monad m, given two functions f1 :: a -> m b -- and f2 :: b -> m c, their Kleisli composition (f1 -- >=> f2) :: a -> m c is defined by: -- --
-- (f1 >=> f2) a = f1 a >>= f2 ---- -- Another way of thinking about foldlM is that it amounts to an -- application to z of a Kleisli composition: -- --
-- foldlM f z t = -- flip f a >=> flip f b >=> ... >=> flip f x >=> flip f y $ z ---- -- The monadic effects of foldlM are sequenced from left to -- right. -- -- If at some step the bind operator (>>=) -- short-circuits (as with, e.g., mzero in a MonadPlus), -- the evaluated effects will be from an initial segment of the element -- sequence. If you want to evaluate the monadic effects in right-to-left -- order, or perhaps be able to short-circuit after processing a tail of -- the sequence of elements, you'll need to use foldrM instead. -- -- If the monadic effects don't short-circuit, the outermost application -- of f is to the rightmost element y, so that, -- ignoring effects, the result looks like a left fold: -- --
-- ((((z `f` a) `f` b) ... `f` w) `f` x) `f` y ---- --
-- >>> let f a e = do { print e ; return $ e : a }
--
-- >>> foldlM f [] [0..3]
-- 0
-- 1
-- 2
-- 3
-- [3,2,1,0]
--
foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
-- | An infix synonym for fmap.
--
-- The name of this operator is an allusion to $. Note the
-- similarities between their types:
--
-- -- ($) :: (a -> b) -> a -> b -- (<$>) :: Functor f => (a -> b) -> f a -> f b ---- -- Whereas $ is function application, <$> is function -- application lifted over a Functor. -- --
-- >>> show <$> Nothing -- Nothing -- -- >>> show <$> Just 3 -- Just "3" ---- -- Convert from an Either Int Int to an -- Either Int String using show: -- --
-- >>> show <$> Left 17 -- Left 17 -- -- >>> show <$> Right 17 -- Right "17" ---- -- Double each element of a list: -- --
-- >>> (*2) <$> [1,2,3] -- [2,4,6] ---- -- Apply even to the second element of a pair: -- --
-- >>> even <$> (2,2) -- (2,True) --(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 <$> pprTypeForUser :: Type -> SDoc -- | Pretty-prints a TyThing with its defining location. pprTyThingLoc :: TyThing -> SDoc -- | Like pprTyThingInContext, but adds the defining location. pprTyThingInContextLoc :: TyThing -> SDoc -- | Pretty-prints a TyThing in context: that is, if the entity is a -- data constructor, record selector, or class method, then the entity's -- parent declaration is pretty-printed with irrelevant parts omitted. pprTyThingInContext :: ShowSub -> TyThing -> SDoc -- | Pretty-prints the TyThing header. For functions and data -- constructors the function is equivalent to pprTyThing but for -- type constructors and classes it prints only the header part of the -- declaration. pprTyThingHdr :: TyThing -> SDoc -- | Pretty-prints a TyThing. pprTyThing :: ShowSub -> TyThing -> SDoc -- | Pretty-prints a FamInst (type/data family instance) with its -- defining location. pprFamInst :: FamInst -> SDoc data PluginWithArgs PluginWithArgs :: Plugin -> [CommandLineOption] -> PluginWithArgs -- | the actual callable plugin [paPlugin] :: PluginWithArgs -> Plugin -- | command line arguments for the plugin [paArguments] :: PluginWithArgs -> [CommandLineOption] data PluginRecompile ForceRecompile :: PluginRecompile NoForceRecompile :: PluginRecompile MaybeRecompile :: Fingerprint -> PluginRecompile type FrontendPluginAction = [String] -> [(String, Maybe Phase)] -> Ghc () type CorePlugin = [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo] -- | Command line options gathered from the -PModule.Name:stuff syntax are -- given to you as this type type CommandLineOption = String -- | Perform a constant operation by using all of the plugins in turn. withPlugins_ :: Monad m => HscEnv -> ConstPluginOperation m a -> a -> m () -- | Perform an operation by using all of the plugins in turn. withPlugins :: Monad m => HscEnv -> PluginOperation m a -> a -> m a purePlugin :: [CommandLineOption] -> IO PluginRecompile plugins :: HscEnv -> [PluginWithArgs] pluginRecompile' :: PluginWithArgs -> IO PluginRecompile mapPlugins :: HscEnv -> (Plugin -> [CommandLineOption] -> a) -> [a] lpModuleName :: LoadedPlugin -> ModuleName -- | A renamer plugin which mades the renamed source available in a -- typechecker plugin. keepRenamedSource :: [CommandLineOption] -> TcGblEnv -> HsGroup GhcRn -> TcM (TcGblEnv, HsGroup GhcRn) impurePlugin :: [CommandLineOption] -> IO PluginRecompile flagRecompile :: [CommandLineOption] -> IO PluginRecompile -- | Default plugin: does nothing at all, except for marking that safe -- inference has failed unless -fplugin-trustworthy is passed. -- For compatibility reason you should base all your plugin definitions -- on this default value. defaultPlugin :: Plugin defaultFrontendPlugin :: FrontendPlugin -- | HoleFitPluginR adds a TcRef to hole fit plugins so that plugins can -- track internal state. Note the existential quantification, ensuring -- that the state cannot be modified from outside the plugin. data HoleFitPluginR -- | A function that atomically updates the name cache given a modifier -- function. The second result of the modifier function will be the -- result of the IO action. newtype NameCacheUpdater NCU :: (forall c. () => (NameCache -> (NameCache, c)) -> IO c) -> NameCacheUpdater [updateNameCache] :: NameCacheUpdater -> forall c. () => (NameCache -> (NameCache, c)) -> IO c updNameCacheTc :: Module -> OccName -> (NameCache -> (NameCache, c)) -> TcRnIf a b c updNameCache :: IORef NameCache -> (NameCache -> (NameCache, c)) -> IO c tcIfaceTyVar :: FastString -> IfL TyVar tcIfaceLclId :: FastString -> IfL Id -- | Set the Module of a Name. setNameModule :: Maybe Module -> Name -> TcRnIf m n Name newInteractiveBinder :: HscEnv -> OccName -> SrcSpan -> IO Name newIfaceNames :: [OccName] -> IfL [Name] newIfaceName :: OccName -> IfL Name newGlobalBinder :: Module -> OccName -> SrcSpan -> TcRnIf a b Name mkNameCacheUpdater :: TcRnIf a b NameCacheUpdater lookupOrigIO :: HscEnv -> Module -> OccName -> IO Name -- | Look up the Name for a given Module and OccName. -- Consider alternatively using lookupIfaceTop if you're in the -- IfL monad and Module is simply that of the -- ModIface_ you are typechecking. lookupOrig :: Module -> OccName -> TcRnIf a b Name lookupIfaceVar :: IfaceBndr -> IfL (Maybe TyCoVar) lookupIfaceTyVar :: IfaceTvBndr -> IfL (Maybe TyVar) -- | Look up a top-level name from the current Iface module lookupIfaceTop :: OccName -> IfL Name ifaceExportNames :: [IfaceExport] -> TcRnIf gbl lcl [AvailInfo] externaliseName :: Module -> Name -> TcRnIf m n Name extendIfaceTyVarEnv :: [TyVar] -> IfL a -> IfL a extendIfaceIdEnv :: [Id] -> IfL a -> IfL a extendIfaceEnvs :: [TyCoVar] -> IfL a -> IfL a allocateGlobalBinder :: NameCache -> Module -> OccName -> SrcSpan -> (NameCache, Name) data IsExtraConstraint YesExtraConstraint :: IsExtraConstraint NoExtraConstraint :: IsExtraConstraint xoptM :: Extension -> TcRnIf gbl lcl Bool writeTcRef :: TcRef a -> a -> TcRnIf gbl lcl () wrapLocSndMA :: (a -> TcM (b, c)) -> LocatedA a -> TcM (b, LocatedA c) wrapLocSndM :: (a -> TcM (b, c)) -> Located a -> TcM (b, Located c) wrapLocM_ :: (a -> TcM ()) -> Located a -> TcM () wrapLocMA_ :: (a -> TcM ()) -> LocatedA a -> TcM () wrapLocMA :: (a -> TcM b) -> GenLocated (SrcSpanAnn' ann) a -> TcRn (GenLocated (SrcSpanAnn' ann) b) wrapLocM :: (a -> TcM b) -> Located a -> TcM (Located b) wrapLocFstMA :: (a -> TcM (b, c)) -> LocatedA a -> TcM (LocatedA b, c) wrapLocFstM :: (a -> TcM (b, c)) -> Located a -> TcM (Located b, c) wrapLocAM :: (a -> TcM b) -> LocatedAn an a -> TcM (Located b) woptM :: WarningFlag -> TcRnIf gbl lcl Bool withoutDynamicNow :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a -- | A convenient wrapper for taking a MaybeErr SDoc a and -- throwing an exception if it is an error. withException :: TcRnIf gbl lcl (MaybeErr SDoc a) -> TcRnIf gbl lcl a withDynamicNow :: TcRnIf gbl lcl a -> TcRnIf gbl lcl a whenXOptM :: Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () whenWOptM :: WarningFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () whenNoErrs :: TcM () -> TcM () whenGOptM :: GeneralFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () -- | Do it flag is true whenDOptM :: DumpFlag -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () -- | Display a warning if a condition is met. warnTcM :: WarnReason -> Bool -> (TidyEnv, SDoc) -> TcM () -- | Display a warning if a condition is met. warnTc :: WarnReason -> Bool -> SDoc -> TcM () -- | Display a warning if a condition is met, and the warning is enabled warnIfFlag :: WarningFlag -> Bool -> SDoc -> TcRn () -- | Display a warning if a condition is met. warnIf :: Bool -> SDoc -> TcRn () -- | Update the external package state. -- -- This is an atomic operation and forces evaluation of the modified EPS -- in order to avoid space leaks. updateEps_ :: (ExternalPackageState -> ExternalPackageState) -> TcRnIf gbl lcl () -- | Update the external package state. Returns the second result of the -- modifier function. -- -- This is an atomic operation and forces evaluation of the modified EPS -- in order to avoid space leaks. updateEps :: (ExternalPackageState -> (ExternalPackageState, a)) -> TcRnIf gbl lcl a updTopEnv :: (HscEnv -> HscEnv) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a updTcRef :: TcRef a -> (a -> a) -> TcRnIf gbl lcl () updLclEnv :: (lcl -> lcl) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a updGblEnv :: (gbl -> gbl) -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a unsetXOptM :: Extension -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a unsetWOptM :: WarningFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a unsetGOptM :: GeneralFlag -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a unlessXOptM :: Extension -> TcRnIf gbl lcl () -> TcRnIf gbl lcl () tryTcDiscardingErrs :: TcM r -> TcM r -> TcM r tryTc :: TcRn a -> TcRn (Maybe a, Messages DecoratedSDoc) tryCaptureConstraints :: TcM a -> TcM (Maybe a, WantedConstraints) traceTcConstraints :: String -> TcM () traceTc :: String -> SDoc -> TcRn () traceRn :: String -> SDoc -> TcRn () traceOptTcRn :: DumpFlag -> SDoc -> TcRn () traceOptIf :: DumpFlag -> SDoc -> TcRnIf m n () traceIf :: SDoc -> TcRnIf m n () traceHiDiffs :: SDoc -> TcRnIf m n () tcSelfBootInfo :: TcRn SelfBootInfo -- | tcScalingUsage mult thing_inside runs thing_inside -- and scales all the usage information by mult. tcScalingUsage :: Mult -> TcM a -> TcM a tcIsHsig :: TcRn Bool tcIsHsBootOrSig :: TcRn Bool tcEmitBindingUsage :: UsageEnv -> TcM () -- | tcCollectingUsage thing_inside runs thing_inside and -- returns the usage information which was collected as part of the -- execution of thing_inside. Careful: tcCollectingUsage -- thing_inside itself does not report any usage information, it's -- up to the caller to incorporate the returned usage information into -- the larger context appropriately. tcCollectingUsage :: TcM a -> TcM (UsageEnv, a) setXOptM :: Extension -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a setTcLevel :: TcLevel -> TcM a -> TcM a setTcEvBindsMap :: EvBindsVar -> EvBindMap -> TcM () setStage :: ThStage -> TcM a -> TcRn a setSrcSpanA :: SrcSpanAnn' ann -> TcRn a -> TcRn a setSrcSpan :: SrcSpan -> TcRn a -> TcRn a setLocalRdrEnv :: LocalRdrEnv -> RnM a -> RnM a setLclTypeEnv :: TcLclEnv -> TcM a -> TcM a setLclEnv :: lcl' -> TcRnIf gbl lcl' a -> TcRnIf gbl lcl a setImplicitEnvM :: TypeEnv -> IfL a -> IfL a setGblEnv :: gbl -> TcRnIf gbl lcl a -> TcRnIf gbl lcl a setErrsVar :: TcRef (Messages DecoratedSDoc) -> TcRn a -> TcRn a setErrCtxt :: [ErrCtxt] -> TcM a -> TcM a setEnvs :: (gbl', lcl') -> TcRnIf gbl' lcl' a -> TcRnIf gbl lcl a setCtLocM :: CtLoc -> TcM a -> TcM a setConstraintVar :: TcRef WantedConstraints -> TcM a -> TcM a reportWarning :: WarnReason -> MsgEnvelope DecoratedSDoc -> TcRn () reportErrors :: [MsgEnvelope DecoratedSDoc] -> TcM () reportError :: MsgEnvelope DecoratedSDoc -> TcRn () recoverM :: TcRn r -> TcRn r -> TcRn r -- | Mark that safe inference has failed See Note [Safe Haskell Overlapping -- Instances Implementation] although this is used for more than just -- that failure case. recordUnsafeInfer :: WarningMessages -> TcM () recordThUse :: TcM () recordThSpliceUse :: TcM () readTcRef :: TcRef a -> TcRnIf gbl lcl a pushTcLevelsM :: Int -> TcM a -> TcM (a, TcLevel) pushTcLevelM_ :: TcM a -> TcM a pushTcLevelM :: TcM a -> TcM (TcLevel, a) -- | The name says it all. The returned TcLevel is the *inner* TcLevel. pushLevelAndCaptureConstraints :: TcM a -> TcM (TcLevel, WantedConstraints, a) -- | Like logInfoTcRn, but for user consumption printForUserTcRn :: SDoc -> TcRn () popErrCtxt :: TcM a -> TcM a newUniqueSupply :: TcRnIf gbl lcl UniqSupply newUnique :: TcRnIf gbl lcl Unique newTcRef :: a -> TcRnIf gbl lcl (TcRef a) newTcEvBinds :: TcM EvBindsVar newSysName :: OccName -> TcRnIf gbl lcl Name newSysLocalIds :: FastString -> [Scaled TcType] -> TcRnIf gbl lcl [TcId] newSysLocalId :: FastString -> Mult -> TcType -> TcRnIf gbl lcl TcId -- | Creates an EvBindsVar incapable of holding any bindings. It still -- tracks covar usages (see comments on ebv_tcvs in -- GHC.Tc.Types.Evidence), thus must be made monadically newNoTcEvBinds :: TcM EvBindsVar newNameAt :: OccName -> SrcSpan -> TcM Name newName :: OccName -> TcM Name newArrowScope :: TcM a -> TcM a mkLongErrAt :: SrcSpan -> SDoc -> SDoc -> TcRn (MsgEnvelope DecoratedSDoc) mkIfLclEnv :: Module -> SDoc -> IsBootInterface -> IfLclEnv mkErrInfo :: TidyEnv -> [ErrCtxt] -> TcM SDoc mkDecoratedSDocAt :: SrcSpan -> SDoc -> SDoc -> SDoc -> TcRn (MsgEnvelope DecoratedSDoc) -- | Apply the function to all elements on the input list If all succeed, -- return the list of results Otherwise fail, propagating all errors mapAndReportM :: (a -> TcRn b) -> [a] -> TcRn [b] -- | Drop elements of the input that fail, so the result list can be -- shorter than the argument list mapAndRecoverM :: (a -> TcRn b) -> [a] -> TcRn [b] keepAlive :: Name -> TcRn () isTouchableTcM :: TcTyVar -> TcM Bool -- | Run a TcM action in the context of an existing GblEnv. initTcWithGbl :: HscEnv -> TcGblEnv -> RealSrcSpan -> TcM r -> IO (Messages DecoratedSDoc, Maybe r) initTcRnIf :: Char -> HscEnv -> gbl -> lcl -> TcRnIf gbl lcl a -> IO a initTcInteractive :: HscEnv -> TcM a -> IO (Messages DecoratedSDoc, Maybe a) -- | Setup the initial typechecking environment initTc :: HscEnv -> HscSource -> Bool -> Module -> RealSrcSpan -> TcM r -> IO (Messages DecoratedSDoc, Maybe r) -- | Run an IfG (top-level interface monad) computation inside an -- existing TcRn (typecheck-renaming monad) computation by -- initializing an IfGblEnv based on TcGblEnv. initIfaceTcRn :: IfG a -> TcRn a initIfaceLoad :: HscEnv -> IfG a -> IO a -- | Initialize interface typechecking, but with a NameShape to -- apply when typechecking top-level OccNames (see -- lookupIfaceTop) initIfaceLclWithSubst :: Module -> SDoc -> IsBootInterface -> NameShape -> IfL a -> IfM lcl a initIfaceLcl :: Module -> SDoc -> IsBootInterface -> IfL a -> IfM lcl a initIfaceCheck :: SDoc -> HscEnv -> IfG a -> IO a inGeneratedCode :: TcRn Bool ifErrsM :: TcRn r -> TcRn r -> TcRn r goptM :: GeneralFlag -> TcRnIf gbl lcl Bool getTopEnv :: TcRnIf gbl lcl HscEnv getTcLevel :: TcM TcLevel getTcEvTyCoVars :: EvBindsVar -> TcM TyCoVarSet getTcEvBindsMap :: EvBindsVar -> TcM EvBindMap getStageAndBindLevel :: Name -> TcRn (Maybe (TopLevelFlag, ThLevel, ThStage)) getStage :: TcM ThStage getSrcSpanM :: TcRn SrcSpan getRecFieldEnv :: TcRn RecFieldEnv getRdrEnvs :: TcRn (GlobalRdrEnv, LocalRdrEnv) getPrintUnqualified :: TcRn PrintUnqualified getLocalRdrEnv :: RnM LocalRdrEnv getLclTypeEnv :: TcM TcTypeEnv getLclEnv :: TcRnIf gbl lcl lcl getIsGHCi :: TcRn Bool getInteractivePrintName :: TcRn Name getImports :: TcRn ImportAvails getIfModule :: IfL Module getHpt :: TcRnIf gbl lcl HomePackageTable getGlobalRdrEnv :: TcRn GlobalRdrEnv getGhcMode :: TcRnIf gbl lcl GhcMode getGblEnv :: TcRnIf gbl lcl gbl getGHCiMonad :: TcRn Name getFixityEnv :: TcRn FixityEnv getErrsVar :: TcRn (TcRef (Messages DecoratedSDoc)) getErrCtxt :: TcM [ErrCtxt] getEpsVar :: TcRnIf gbl lcl (TcRef ExternalPackageState) getEpsAndHpt :: TcRnIf gbl lcl (ExternalPackageState, HomePackageTable) getEps :: TcRnIf gbl lcl ExternalPackageState getEnvs :: TcRnIf gbl lcl (gbl, lcl) getDeclaredDefaultTys :: TcRn (Maybe [Type]) getCtLocM :: CtOrigin -> Maybe TypeOrKind -> TcM CtLoc getConstraintVar :: TcM (TcRef WantedConstraints) -- | See getCCIndexM. getCCIndexTcM :: FastString -> TcM CostCentreIndex -- | Get the next cost centre index associated with a given name. getCCIndexM :: (gbl -> TcRef CostCentreState) -> FastString -> TcRnIf gbl lcl CostCentreIndex -- | Run thing_inside in an interleaved thread. It shares everything with -- the parent thread, so this is DANGEROUS. -- -- It returns Nothing if the computation fails -- -- It's used for lazily type-checking interface signatures, which is -- pretty benign. -- -- See Note [Masking exceptions in forkM_maybe] forkM_maybe :: SDoc -> IfL a -> IfL (Maybe a) forkM :: SDoc -> IfL a -> IfL a -- | The accumulator is not updated if the action fails foldAndRecoverM :: (b -> a -> TcRn b) -> b -> [a] -> TcRn b -- | Switch instances to safe instances if we're in Safe mode. fixSafeInstances :: SafeHaskellMode -> [ClsInst] -> [ClsInst] -- | Figure out the final correct safe haskell mode finalSafeMode :: DynFlags -> TcGblEnv -> IO SafeHaskellMode failWithTcM :: (TidyEnv, SDoc) -> TcM a failWithTc :: SDoc -> TcM a failWith :: SDoc -> TcRn a failIfTcM :: Bool -> (TidyEnv, SDoc) -> TcM () failIfTc :: Bool -> SDoc -> TcM () failIfM :: SDoc -> IfL a failIfErrsM :: TcRn () failAt :: SrcSpan -> SDoc -> TcRn a extendFixityEnv :: [(Name, FixItem)] -> RnM a -> RnM a escapeArrowScope :: TcM a -> TcM a emitStaticConstraints :: WantedConstraints -> TcM () emitSimples :: Cts -> TcM () emitSimple :: Ct -> TcM () emitNamedTypeHole :: (Name, TcTyVar) -> TcM () emitInsoluble :: Ct -> TcM () emitImplications :: Bag Implication -> TcM () emitImplication :: Implication -> TcM () emitHoles :: Bag Hole -> TcM () emitHole :: Hole -> TcM () emitConstraints :: WantedConstraints -> TcM () emitAnonTypeHole :: IsExtraConstraint -> TcTyVar -> TcM () -- | Unconditionally dump some trace output -- -- Certain tests (T3017, Roles3, T12763 etc.) expect part of the output -- generated by `-ddump-types` to be in PprUser style. However, -- generally we want all other debugging output to use PprDump -- style. We PprUser style if useUserStyle is True. dumpTcRn :: Bool -> DumpFlag -> String -> DumpFormat -> SDoc -> TcRn () -- | Dump if the given DumpFlag is set. dumpOptTcRn :: DumpFlag -> String -> DumpFormat -> SDoc -> TcRn () doptM :: DumpFlag -> TcRnIf gbl lcl Bool discardWarnings :: TcRn a -> TcRn a discardResult :: TcM a -> TcM () discardErrs :: TcRn a -> TcRn a -- | Throw out any constraints emitted by the thing_inside discardConstraints :: TcM a -> TcM a debugTc :: TcM () -> TcM () cloneLocalName :: Name -> TcM Name cloneEvBindsVar :: EvBindsVar -> TcM EvBindsVar chooseUniqueOccTc :: (OccSet -> OccName) -> TcM OccName checkTcM :: Bool -> (TidyEnv, SDoc) -> TcM () checkTc :: Bool -> SDoc -> TcM () checkNoErrs :: TcM r -> TcM r checkErr :: Bool -> SDoc -> TcRn () captureConstraints :: TcM a -> TcM (a, WantedConstraints) attemptM :: TcRn r -> TcRn (Maybe r) askNoErrs :: TcRn a -> TcRn (a, Bool) -- | Display a warning, with an optional flag, for the current source -- location. add_warn :: WarnReason -> SDoc -> SDoc -> TcRn () -- | Display a warning in a given context. addWarnTcM :: WarnReason -> (TidyEnv, SDoc) -> TcM () -- | Display a warning in the current context. addWarnTc :: WarnReason -> SDoc -> TcM () -- | Display a warning for a given source location. addWarnAt :: WarnReason -> SrcSpan -> SDoc -> TcRn () -- | Display a warning for the current source location. addWarn :: WarnReason -> SDoc -> TcRn () addTopEvBinds :: Bag EvBind -> TcM a -> TcM a addTcEvBind :: EvBindsVar -> EvBind -> TcM () -- | Adds the given modFinalizers to the global environment and set them to -- use the current local environment. addModFinalizersWithLclEnv :: ThModFinalizers -> TcM () addMessages :: Messages DecoratedSDoc -> TcRn () addLongErrAt :: SrcSpan -> SDoc -> SDoc -> TcRn () addLocMA :: (a -> TcM b) -> GenLocated (SrcSpanAnn' ann) a -> TcM b addLocM :: (a -> TcM b) -> Located a -> TcM b -- | Variant of addLandmarkErrCtxt that allows for monadic -- operations and tidying. addLandmarkErrCtxtM :: (TidyEnv -> TcM (TidyEnv, SDoc)) -> TcM a -> TcM a -- | Add a fixed landmark message to the error context. A landmark message -- is always sure to be reported, even if there is a lot of context. It -- also doesn't count toward the maximum number of contexts reported. addLandmarkErrCtxt :: SDoc -> TcM a -> TcM a addErrs :: [(SrcSpan, SDoc)] -> TcRn () addErrTcM :: (TidyEnv, SDoc) -> TcM () addErrTc :: SDoc -> TcM () -- | Add a message to the error context. This message may do tidying. addErrCtxtM :: (TidyEnv -> TcM (TidyEnv, SDoc)) -> TcM a -> TcM a -- | Add a fixed message to the error context. This message should not do -- any tidying. addErrCtxt :: SDoc -> TcM a -> TcM a addErrAt :: SrcSpan -> SDoc -> TcRn () addErr :: SDoc -> TcRn () addDependentFiles :: [FilePath] -> TcRn () data WhereFrom ImportByUser :: IsBootInterface -> WhereFrom ImportBySystem :: WhereFrom ImportByPlugin :: WhereFrom data ThStage Splice :: SpliceType -> ThStage RunSplice :: TcRef [ForeignRef (Q ())] -> ThStage Comp :: ThStage Brack :: ThStage -> PendingStuff -> ThStage type ThLevel = Int type TcTypeEnv = NameEnv TcTyThing -- | A typecheckable thing available in a local context. Could be -- AGlobal TyThing, but also lexically scoped variables, -- etc. See GHC.Tc.Utils.Env for how to retrieve a TyThing -- given a Name. data TcTyThing AGlobal :: TyThing -> TcTyThing ATcId :: TcId -> IdBindingInfo -> TcTyThing [tct_id] :: TcTyThing -> TcId [tct_info] :: TcTyThing -> IdBindingInfo ATyVar :: Name -> TcTyVar -> TcTyThing ATcTyCon :: TyCon -> TcTyThing APromotionErr :: PromotionErr -> TcTyThing data TcSigInfo TcIdSig :: TcIdSigInfo -> TcSigInfo TcPatSynSig :: TcPatSynInfo -> TcSigInfo type TcSigFun = Name -> Maybe TcSigInfo type TcRnIf a b = IOEnv Env a b type TcRn = TcRnIf TcGblEnv TcLclEnv -- | Type alias for IORef; the convention is we'll use this for -- mutable bits of data in TcGblEnv which are updated during -- typechecking and returned at the end. type TcRef a = IORef a type TcPluginSolver = [Ct] -> [Ct] -> [Ct] -> TcPluginM TcPluginResult data TcPluginResult -- | The plugin found a contradiction. The returned constraints are removed -- from the inert set, and recorded as insoluble. TcPluginContradiction :: [Ct] -> TcPluginResult -- | The first field is for constraints that were solved. These are removed -- from the inert set, and the evidence for them is recorded. The second -- field contains new work, that should be processed by the constraint -- solver. TcPluginOk :: [(EvTerm, Ct)] -> [Ct] -> TcPluginResult data TcPluginM a data TcPlugin TcPlugin :: TcPluginM s -> (s -> TcPluginSolver) -> (s -> TcPluginM ()) -> TcPlugin -- | Initialize plugin, when entering type-checker. [tcPluginInit] :: TcPlugin -> TcPluginM s -- | Solve some constraints. TODO: WRITE MORE DETAILS ON HOW THIS WORKS. [tcPluginSolve] :: TcPlugin -> s -> TcPluginSolver -- | Clean up after the plugin, when exiting the type-checker. [tcPluginStop] :: TcPlugin -> s -> TcPluginM () data TcPatSynInfo TPSI :: Name -> [InvisTVBinder] -> [InvisTVBinder] -> TcThetaType -> [InvisTVBinder] -> TcThetaType -> TcSigmaType -> TcPatSynInfo [patsig_name] :: TcPatSynInfo -> Name [patsig_implicit_bndrs] :: TcPatSynInfo -> [InvisTVBinder] [patsig_univ_bndrs] :: TcPatSynInfo -> [InvisTVBinder] [patsig_req] :: TcPatSynInfo -> TcThetaType [patsig_ex_bndrs] :: TcPatSynInfo -> [InvisTVBinder] [patsig_prov] :: TcPatSynInfo -> TcThetaType [patsig_body_ty] :: TcPatSynInfo -> TcSigmaType -- | Historical "type-checking monad" (now it's just TcRn). type TcM = TcRn data TcIdSigInst TISI :: TcIdSigInfo -> [(Name, InvisTVBinder)] -> TcThetaType -> TcSigmaType -> [(Name, TcTyVar)] -> Maybe TcType -> TcIdSigInst [sig_inst_sig] :: TcIdSigInst -> TcIdSigInfo [sig_inst_skols] :: TcIdSigInst -> [(Name, InvisTVBinder)] [sig_inst_theta] :: TcIdSigInst -> TcThetaType [sig_inst_tau] :: TcIdSigInst -> TcSigmaType [sig_inst_wcs] :: TcIdSigInst -> [(Name, TcTyVar)] [sig_inst_wcx] :: TcIdSigInst -> Maybe TcType data TcIdSigInfo CompleteSig :: TcId -> UserTypeCtxt -> SrcSpan -> TcIdSigInfo [sig_bndr] :: TcIdSigInfo -> TcId [sig_ctxt] :: TcIdSigInfo -> UserTypeCtxt [sig_loc] :: TcIdSigInfo -> SrcSpan PartialSig :: Name -> LHsSigWcType GhcRn -> UserTypeCtxt -> SrcSpan -> TcIdSigInfo [psig_name] :: TcIdSigInfo -> Name [psig_hs_ty] :: TcIdSigInfo -> LHsSigWcType GhcRn [sig_ctxt] :: TcIdSigInfo -> UserTypeCtxt [sig_loc] :: TcIdSigInfo -> SrcSpan type TcIdSet = IdSet type TcId = Id -- | TcGblEnv describes the top-level of the module at the point at -- which the typechecker is finished work. It is this structure that is -- handed on to the desugarer For state that needs to be updated during -- the typechecking phase and returned at end, use a TcRef (= -- IORef). data TcGblEnv TcGblEnv :: Module -> Module -> HscSource -> GlobalRdrEnv -> Maybe [Type] -> FixityEnv -> RecFieldEnv -> TypeEnv -> TcRef TypeEnv -> !InstEnv -> !FamInstEnv -> AnnEnv -> [AvailInfo] -> ImportAvails -> DefUses -> TcRef [GlobalRdrElt] -> TcRef NameSet -> TcRef Bool -> TcRef Bool -> TcRef OccSet -> [(Module, Fingerprint)] -> Maybe [(LIE GhcRn, Avails)] -> [LImportDecl GhcRn] -> Maybe (HsGroup GhcRn) -> TcRef [FilePath] -> TcRef [LHsDecl GhcPs] -> TcRef [(ForeignSrcLang, FilePath)] -> TcRef NameSet -> TcRef [(TcLclEnv, ThModFinalizers)] -> TcRef [String] -> TcRef (Map TypeRep Dynamic) -> TcRef (Maybe (ForeignRef (IORef QState))) -> TcRef THDocs -> Bag EvBind -> Maybe Id -> LHsBinds GhcTc -> NameSet -> [LTcSpecPrag] -> Warnings -> [Annotation] -> [TyCon] -> NameSet -> [ClsInst] -> [FamInst] -> [LRuleDecl GhcTc] -> [LForeignDecl GhcTc] -> [PatSyn] -> Maybe LHsDocString -> !AnyHpcUsage -> SelfBootInfo -> Maybe Name -> TcRef (Bool, WarningMessages) -> [TcPluginSolver] -> [HoleFitPlugin] -> RealSrcSpan -> TcRef WantedConstraints -> !CompleteMatches -> TcRef CostCentreState -> TcGblEnv -- | Module being compiled [tcg_mod] :: TcGblEnv -> Module -- | If a signature, the backing module See also Note [Identity versus -- semantic module] [tcg_semantic_mod] :: TcGblEnv -> Module -- | What kind of module (regular Haskell, hs-boot, hsig) [tcg_src] :: TcGblEnv -> HscSource -- | Top level envt; used during renaming [tcg_rdr_env] :: TcGblEnv -> GlobalRdrEnv -- | Types used for defaulting. Nothing => no default -- decl [tcg_default] :: TcGblEnv -> Maybe [Type] -- | Just for things in this module [tcg_fix_env] :: TcGblEnv -> FixityEnv -- | Just for things in this module See Note [The interactive package] in -- GHC.Runtime.Context [tcg_field_env] :: TcGblEnv -> RecFieldEnv -- | Global type env for the module we are compiling now. All TyCons and -- Classes (for this module) end up in here right away, along with their -- derived constructors, selectors. -- -- (Ids defined in this module start in the local envt, though they move -- to the global envt during zonking) -- -- NB: for what "things in this module" means, see Note [The interactive -- package] in GHC.Runtime.Context [tcg_type_env] :: TcGblEnv -> TypeEnv [tcg_type_env_var] :: TcGblEnv -> TcRef TypeEnv -- | Instance envt for all home-package modules; Includes the dfuns -- in tcg_insts NB. BangPattern is to fix a leak, see #15111 [tcg_inst_env] :: TcGblEnv -> !InstEnv -- | Ditto for family instances NB. BangPattern is to fix a leak, see -- #15111 [tcg_fam_inst_env] :: TcGblEnv -> !FamInstEnv -- | And for annotations [tcg_ann_env] :: TcGblEnv -> AnnEnv -- | What is exported [tcg_exports] :: TcGblEnv -> [AvailInfo] -- | Information about what was imported from where, including things bound -- in this module. Also store Safe Haskell info here about transitive -- trusted package requirements. -- -- There are not many uses of this field, so you can grep for all them. -- -- The ImportAvails records information about the following things: -- --
-- mkSmallTupleSelector [x] x v e = [| e |]
-- mkSmallTupleSelector [x,y,z] x v e = [| case e of v { (x,y,z) -> x } |]
--
mkSmallTupleSelector :: [Id] -> Id -> Id -> CoreExpr -> CoreExpr
-- | As mkTupleCase, but for a tuple that is small enough to be
-- guaranteed not to need nesting.
mkSmallTupleCase :: [Id] -> CoreExpr -> Id -> CoreExpr -> CoreExpr
mkRuntimeErrorApp :: Id -> Type -> String -> CoreExpr
-- | Makes a Nothing for the specified type
mkNothingExpr :: Type -> CoreExpr
mkNonEmptyListExpr :: Type -> CoreExpr -> [CoreExpr] -> CoreExpr
-- | Makes a list [] for lists of the specified type
mkNilExpr :: Type -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Natural
mkNaturalExpr :: Integer -> CoreExpr
-- | Make a list containing the given expressions, where the list has the
-- given type
mkListExpr :: Type -> [CoreExpr] -> CoreExpr
-- | Makes a Just from a value of the specified type
mkJustExpr :: Type -> CoreExpr -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Integer
mkIntegerExpr :: Integer -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given Int
mkIntExprInt :: Platform -> Int -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given Int
mkIntExpr :: Platform -> Integer -> CoreExpr
mkImpossibleExpr :: Type -> CoreExpr
mkIfThenElse :: CoreExpr -> CoreExpr -> CoreExpr -> CoreExpr
-- | Make a fully applied foldr expression
mkFoldrExpr :: MonadThings m => Type -> Type -> CoreExpr -> CoreExpr -> CoreExpr -> m CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Float
mkFloatExpr :: Float -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Double
mkDoubleExpr :: Double -> CoreExpr
-- | Build the type of a small tuple that holds the specified variables
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkCoreVarTupTy :: [Id] -> Type
-- | Build a small unboxed tuple holding the specified expressions, with
-- the given types. The types must be the types of the expressions. Do
-- not include the RuntimeRep specifiers; this function calculates them
-- for you. Does not flatten one-tuples; see Note [Flattening
-- one-tuples]
mkCoreUbxTup :: [Type] -> [CoreExpr] -> CoreExpr
-- | Build an unboxed sum.
--
-- Alternative number ("alt") starts from 1.
mkCoreUbxSum :: Int -> Int -> [Type] -> CoreExpr -> CoreExpr
-- | Make a core tuple of the given boxity; don't flatten 1-tuples
mkCoreTupBoxity :: Boxity -> [CoreExpr] -> CoreExpr
-- | Build a small tuple holding the specified expressions One-tuples are
-- flattened; see Note [Flattening one-tuples]
mkCoreTup :: [CoreExpr] -> CoreExpr
-- | Bind a list of binding groups over an expression. The leftmost binding
-- group becomes the outermost group in the resulting expression
mkCoreLets :: [CoreBind] -> CoreExpr -> CoreExpr
-- | Bind a binding group over an expression, using a let or
-- case as appropriate (see GHC.Core#let_app_invariant)
mkCoreLet :: CoreBind -> CoreExpr -> CoreExpr
-- | Create a lambda where the given expression has a number of variables
-- bound over it. The leftmost binder is that bound by the outermost
-- lambda in the result
mkCoreLams :: [CoreBndr] -> CoreExpr -> CoreExpr
-- | Construct an expression which represents the application of a number
-- of expressions to that of a data constructor expression. The leftmost
-- expression in the list is applied first
mkCoreConApps :: DataCon -> [CoreExpr] -> CoreExpr
-- | Construct an expression which represents the application of a number
-- of expressions to another. The leftmost expression in the list is
-- applied first Respects the let/app invariant by building a case
-- expression where necessary See Note [Core let/app invariant] in
-- GHC.Core
mkCoreApps :: CoreExpr -> [CoreExpr] -> CoreExpr
infixl 4 `mkCoreApps`
-- | Construct an expression which represents the application of one
-- expression to the other Respects the let/app invariant by building a
-- case expression where necessary See Note [Core let/app invariant] in
-- GHC.Core
mkCoreApp :: SDoc -> CoreExpr -> CoreExpr -> CoreExpr
infixl 4 `mkCoreApp`
-- | Makes a list (:) for lists of the specified type
mkConsExpr :: Type -> CoreExpr -> CoreExpr -> CoreExpr
-- | Create a CoreExpr which will evaluate to the given
-- Char
mkCharExpr :: Char -> CoreExpr
-- | Make a build expression applied to a locally-bound worker
-- function
mkBuildExpr :: (MonadFail m, MonadThings m, MonadUnique m) => Type -> ((Id, Type) -> (Id, Type) -> m CoreExpr) -> m CoreExpr
-- | Build the type of a big tuple that holds the specified variables
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkBigCoreVarTupTy :: [Id] -> Type
mkBigCoreVarTup1 :: [Id] -> CoreExpr
-- | Build a big tuple holding the specified variables One-tuples are
-- flattened; see Note [Flattening one-tuples]
mkBigCoreVarTup :: [Id] -> CoreExpr
-- | Build the type of a big tuple that holds the specified type of thing
-- One-tuples are flattened; see Note [Flattening one-tuples]
mkBigCoreTupTy :: [Type] -> Type
-- | Build a big tuple holding the specified expressions One-tuples are
-- flattened; see Note [Flattening one-tuples]
mkBigCoreTup :: [CoreExpr] -> CoreExpr
mkAbsentErrorApp :: Type -> String -> CoreExpr
floatBindings :: FloatBind -> [Var]
errorIds :: [Id]
castBottomExpr :: CoreExpr -> Type -> CoreExpr
aBSENT_SUM_FIELD_ERROR_ID :: Id
aBSENT_ERROR_ID :: Id
-- | This class specifies how to collect variable identifiers from
-- extension patterns in the given pass. Consumers of the GHC API that
-- define their own passes should feel free to implement instances in
-- order to make use of functions which depend on it.
--
-- In particular, Haddock already makes use of this, with an instance for
-- its DocNameI pass so that it can reuse the code in GHC for
-- collecting binders.
class UnXRec p => CollectPass p
collectXXPat :: CollectPass p => Proxy p -> CollectFlag p -> XXPat p -> [IdP p] -> [IdP p]
-- | Indicate if evidence binders have to be collected.
--
-- This type is used as a boolean (should we collect evidence binders or
-- not?) but also to pass an evidence that the AST has been typechecked
-- when we do want to collect evidence binders, otherwise these binders
-- are not available.
--
-- See Note [Dictionary binders in ConPatOut]
data CollectFlag p
-- | Don't collect evidence binders
[CollNoDictBinders] :: forall p. CollectFlag p
-- | Collect evidence binders
[CollWithDictBinders] :: CollectFlag (GhcPass 'Typechecked)
unitRecStmtTc :: RecStmtTc
unguardedRHS :: forall (p :: Pass) body. Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpan => EpAnn GrhsAnn -> SrcSpan -> LocatedA (body (GhcPass p)) -> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))]
unguardedGRHSs :: forall (p :: Pass) body. Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpan => SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn GrhsAnn -> GRHSs (GhcPass p) (LocatedA (body (GhcPass p)))
-- | Return the SrcSpan encompassing the contents of any enclosed
-- binds
spanHsLocaLBinds :: forall (p :: Pass). Data (HsLocalBinds (GhcPass p)) => HsLocalBinds (GhcPass p) -> SrcSpan
nl_HsVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> HsExpr (GhcPass p)
-- | Wildcard pattern - after renaming
nlWildPatName :: LPat GhcRn
-- | Wildcard pattern - after parsing
nlWildPat :: LPat GhcPs
nlWildConPat :: DataCon -> LPat GhcPs
nlVarPat :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LPat (GhcPass p)
nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs
nlParPat :: forall (name :: Pass). LPat (GhcPass name) -> LPat (GhcPass name)
nlNullaryConPat :: RdrName -> LPat GhcPs
nlLitPat :: HsLit GhcPs -> LPat GhcPs
nlList :: [LHsExpr GhcPs] -> LHsExpr GhcPs
nlInfixConPat :: RdrName -> LPat GhcPs -> LPat GhcPs -> LPat GhcPs
nlHsVarApps :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> [IdP (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LHsExpr (GhcPass p)
nlHsTyVar :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> LHsType (GhcPass p)
nlHsTyConApp :: forall (p :: Pass) a. IsSrcSpanAnn p a => LexicalFixity -> IdP (GhcPass p) -> [LHsTypeArg (GhcPass p)] -> LHsType (GhcPass p)
nlHsTyApps :: Id -> [Type] -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsTyApp :: Id -> [Type] -> LHsExpr GhcTc
nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc] -> LHsExpr GhcTc
nlHsParTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsPar :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsLit :: forall (p :: Pass). HsLit (GhcPass p) -> LHsExpr (GhcPass p)
nlHsLam :: LMatch GhcPs (LHsExpr GhcPs) -> LHsExpr GhcPs
nlHsIntLit :: forall (p :: Pass). Integer -> LHsExpr (GhcPass p)
nlHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs
nlHsFunTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsDo :: HsStmtContext GhcRn -> [LStmt GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
-- | NB: Only for LHsExpr Id.
nlHsDataCon :: DataCon -> LHsExpr GhcTc
nlHsCase :: LHsExpr GhcPs -> [LMatch GhcPs (LHsExpr GhcPs)] -> LHsExpr GhcPs
nlHsApps :: forall (p :: Pass) a. IsSrcSpanAnn p a => IdP (GhcPass p) -> [LHsExpr (GhcPass p)] -> LHsExpr (GhcPass p)
nlHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p)
nlHsAppKindTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsKind (GhcPass p) -> LHsType (GhcPass p)
nlHsApp :: forall (id :: Pass). IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
nlConVarPatName :: Name -> [Name] -> LPat GhcRn
nlConVarPat :: RdrName -> [RdrName] -> LPat GhcPs
nlConPatName :: Name -> [LPat GhcRn] -> LPat GhcRn
nlConPat :: RdrName -> [LPat GhcPs] -> LPat GhcPs
mkVarBind :: forall (p :: Pass). IdP (GhcPass p) -> LHsExpr (GhcPass p) -> LHsBind (GhcPass p)
mkUntypedSplice :: EpAnn [AddEpAnn] -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs
mkTypedSplice :: EpAnn [AddEpAnn] -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs
mkTransformStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
mkTransformByStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs)
-- | In Name-land, with empty bind_fvs
mkTopFunBind :: Origin -> LocatedN Name -> [LMatch GhcRn (LHsExpr GhcRn)] -> HsBind GhcRn
mkTcBindStmt :: LPat GhcTc -> LocatedA (bodyR GhcTc) -> StmtLR GhcTc GhcTc (LocatedA (bodyR GhcTc))
mkSimpleMatch :: forall (p :: Pass) body. (Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA, Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpan) => HsMatchContext (NoGhcTc (GhcPass p)) -> [LPat (GhcPass p)] -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
-- | Convenience function using mkFunBind. This is for generated
-- bindings only, do not use for user-written code.
mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> [LPat GhcPs] -> LHsExpr GhcPs -> LHsBind GhcPs
mkRnBindStmt :: LPat GhcRn -> LocatedA (bodyR GhcRn) -> StmtLR GhcRn GhcRn (LocatedA (bodyR GhcRn))
mkRecStmt :: forall (idL :: Pass) bodyR. Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnL => EpAnn AnnList -> LocatedL [LStmtLR (GhcPass idL) GhcPs bodyR] -> StmtLR (GhcPass idL) GhcPs bodyR
mkPsBindStmt :: EpAnn [AddEpAnn] -> LPat GhcPs -> LocatedA (bodyR GhcPs) -> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs))
-- | Make a prefix, non-strict function HsMatchContext
mkPrefixFunRhs :: LIdP p -> HsMatchContext p
mkPatSynBind :: LocatedN RdrName -> HsPatSynDetails GhcPs -> LPat GhcPs -> HsPatSynDir GhcPs -> EpAnn [AddEpAnn] -> HsBind GhcPs
mkParPat :: forall (p :: Pass). IsPass p => LPat (GhcPass p) -> LPat (GhcPass p)
mkNPlusKPat :: LocatedN RdrName -> Located (HsOverLit GhcPs) -> EpAnn EpaLocation -> Pat GhcPs
mkNPat :: Located (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpAnn [AddEpAnn] -> Pat GhcPs
mkMatchGroup :: forall (p :: Pass) body. AnnoBody p body => Origin -> LocatedL [LocatedA (Match (GhcPass p) (LocatedA (body (GhcPass p))))] -> MatchGroup (GhcPass p) (LocatedA (body (GhcPass p)))
mkMatch :: forall (p :: Pass). IsPass p => HsMatchContext (NoGhcTc (GhcPass p)) -> [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> HsLocalBinds (GhcPass p) -> LMatch (GhcPass p) (LHsExpr (GhcPass p))
mkLocatedList :: Semigroup a => [GenLocated (SrcAnn a) e2] -> LocatedAn an [GenLocated (SrcAnn a) e2]
mkLetStmt :: EpAnn [AddEpAnn] -> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b)
mkLastStmt :: forall (idR :: Pass) bodyR (idL :: Pass). IsPass idR => LocatedA (bodyR (GhcPass idR)) -> StmtLR (GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR)))
mkLHsWrapCo :: TcCoercionN -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsWrap :: HsWrapper -> LHsExpr GhcTc -> LHsExpr GhcTc
mkLHsVarTuple :: forall (p :: Pass) a. IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
mkLHsTupleExpr :: forall (p :: Pass). [LHsExpr (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p)
-- | Wrap in parens if hsExprNeedsParens appPrec says it
-- needs them So f x becomes (f x), but 3
-- stays as 3.
mkLHsPar :: forall (id :: Pass). IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
mkLHsCmdWrap :: HsWrapper -> LHsCmd GhcTc -> LHsCmd GhcTc
mkHsWrapPatCo :: TcCoercionN -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapPat :: HsWrapper -> Pat GhcTc -> Type -> Pat GhcTc
mkHsWrapCoR :: TcCoercionR -> HsExpr GhcTc -> HsExpr GhcTc
mkHsWrapCo :: TcCoercionN -> HsExpr GhcTc -> HsExpr GhcTc
-- | Avoid HsWrap co1 (HsWrap co2 _) and
-- HsWrap co1 (HsPar _ _) See Note [Detecting
-- forced eta expansion] in GHC.HsToCore.Expr
mkHsWrap :: HsWrapper -> HsExpr GhcTc -> HsExpr GhcTc
mkHsVarBind :: SrcSpan -> RdrName -> LHsExpr GhcPs -> LHsBind GhcPs
mkHsStringPrimLit :: forall (p :: Pass). FastString -> HsLit (GhcPass p)
mkHsString :: forall (p :: Pass). String -> HsLit (GhcPass p)
mkHsSigEnv :: (LSig GhcRn -> Maybe ([LocatedN Name], a)) -> [LSig GhcRn] -> NameEnv a
mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsSplice GhcPs
-- | -- e => (e) --mkHsPar :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -- | A useful function for building OpApps. The operator is always -- a variable, and we don't know the fixity yet. mkHsOpApp :: LHsExpr GhcPs -> IdP GhcPs -> LHsExpr GhcPs -> HsExpr GhcPs mkHsLams :: [TyVar] -> [EvVar] -> LHsExpr GhcTc -> LHsExpr GhcTc mkHsLam :: forall (p :: Pass). (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ NoExtField) => [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs mkHsIntegral :: IntegralLit -> HsOverLit GhcPs mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> EpAnn AnnsIf -> HsExpr GhcPs mkHsFractional :: FractionalLit -> HsOverLit GhcPs mkHsDoAnns :: HsStmtContext GhcRn -> LocatedL [ExprLStmt GhcPs] -> EpAnn AnnList -> HsExpr GhcPs mkHsDo :: HsStmtContext GhcRn -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs mkHsDictLet :: TcEvBinds -> LHsExpr GhcTc -> LHsExpr GhcTc mkHsCompAnns :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> EpAnn AnnList -> HsExpr GhcPs mkHsComp :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> HsExpr GhcPs mkHsCmdWrap :: HsWrapper -> HsCmd GhcTc -> HsCmd GhcTc mkHsCmdIf :: LHsExpr GhcPs -> LHsCmd GhcPs -> LHsCmd GhcPs -> EpAnn AnnsIf -> HsCmd GhcPs mkHsCharPrimLit :: forall (p :: Pass). Char -> HsLit (GhcPass p) -- | A simple case alternative with a single pattern, no binds, no guards; -- pre-typechecking mkHsCaseAlt :: forall (p :: Pass) body. (Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpan, Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpanAnnA) => LPat (GhcPass p) -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p))) mkHsAppsWith :: forall (id :: Pass). (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) mkHsApps :: forall (id :: Pass). LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id) mkHsAppWith :: forall (id :: Pass). (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id)) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn mkHsAppType :: LHsExpr GhcRn -> LHsWcType GhcRn -> LHsExpr GhcRn mkHsApp :: forall (id :: Pass). LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) mkGroupUsingStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) mkGroupByUsingStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) -- | Not infix, with place holders for coercion and free vars mkFunBind :: Origin -> LocatedN RdrName -> [LMatch GhcPs (LHsExpr GhcPs)] -> HsBind GhcPs -- | Convert TypeSig to ClassOpSig. The former is what is -- parsed, but the latter is what we need in class/instance declarations mkClassOpSigs :: [LSig GhcPs] -> [LSig GhcPs] -- | Lifts a "small" constructor into a "big" constructor by recursive -- decomposition mkChunkified :: ([a] -> a) -> [a] -> a mkBodyStmt :: forall bodyR (idL :: Pass). LocatedA (bodyR GhcPs) -> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs)) -- | The Big equivalents for the source tuple expressions mkBigLHsVarTup :: forall (p :: Pass) a. IsSrcSpanAnn p a => [IdP (GhcPass p)] -> XExplicitTuple (GhcPass p) -> LHsExpr (GhcPass p) -- | The Big equivalents for the source tuple patterns mkBigLHsVarPatTup :: [IdP GhcRn] -> LPat GhcRn mkBigLHsTup :: forall (id :: Pass). [LHsExpr (GhcPass id)] -> XExplicitTuple (GhcPass id) -> LHsExpr (GhcPass id) mkBigLHsPatTup :: [LPat GhcRn] -> LPat GhcRn missingTupArg :: EpAnn EpaLocation -> HsTupArg GhcPs lStmtsImplicits :: forall (idR :: Pass) (body :: Type -> Type). [LStmtLR GhcRn (GhcPass idR) (LocatedA (body (GhcPass idR)))] -> [(SrcSpan, [Name])] lPatImplicits :: LPat GhcRn -> [(SrcSpan, [Name])] -- | Should we treat this as an unlifted bind? This will be true for any -- bind that binds an unlifted variable, but we must be careful around -- AbsBinds. See Note [Unlifted id check in isUnliftedHsBind]. For usage -- information, see Note [Strict binds checks] is GHC.HsToCore.Binds. isUnliftedHsBind :: HsBind GhcTc -> Bool -- | If any of the matches in the FunBind are infix, the -- FunBind is considered infix. isInfixFunBind :: forall id1 id2. UnXRec id2 => HsBindLR id1 id2 -> Bool -- | Is a binding a strict variable or pattern bind (e.g. !x = -- ...)? isBangedHsBind :: HsBind GhcTc -> Bool hsValBindsImplicits :: forall (idR :: Pass). HsValBindsLR GhcRn (GhcPass idR) -> [(SrcSpan, [Name])] -- | Convert an LHsType to an LHsSigWcType. hsTypeToHsSigWcType :: LHsType GhcPs -> LHsSigWcType GhcPs -- | Convert an LHsType to an LHsSigType. hsTypeToHsSigType :: LHsType GhcPs -> LHsSigType GhcPs hsTyClForeignBinders :: [TyClGroup GhcRn] -> [LForeignDecl GhcRn] -> [Name] -- | Collects record pattern-synonym selectors only; the pattern synonym -- names are collected by collectHsValBinders. hsPatSynSelectors :: forall (p :: Pass). IsPass p => HsValBinds (GhcPass p) -> [FieldOcc (GhcPass p)] -- | Returns all the binding names of the decl. The first one is -- guaranteed to be the name of the decl. The first component represents -- all binding names except record fields; the second represents field -- occurrences. For record fields mentioned in multiple constructors, the -- SrcLoc will be from the first occurrence. -- -- Each returned (Located name) has a SrcSpan for the whole -- declaration. See Note [SrcSpan for binders] hsLTyClDeclBinders :: forall (p :: Pass). IsPass p => LocatedA (TyClDecl (GhcPass p)) -> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)]) hsGroupBinders :: HsGroup GhcRn -> [Name] -- | See Note [SrcSpan for binders] hsForeignDeclsBinders :: forall (p :: Pass) a. (UnXRec (GhcPass p), IsSrcSpanAnn p a) => [LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)] -- | the SrcLoc returned are for the whole declarations, not just -- the names hsDataFamInstBinders :: forall (p :: Pass). IsPass p => DataFamInstDecl (GhcPass p) -> ([LocatedA (IdP (GhcPass p))], [LFieldOcc (GhcPass p)]) getPatSynBinds :: UnXRec id => [(RecFlag, LHsBinds id)] -> [PatSynBind id id] emptyTransStmt :: EpAnn [AddEpAnn] -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) emptyRecStmtName :: Anno [GenLocated (Anno (StmtLR GhcRn GhcRn bodyR)) (StmtLR GhcRn GhcRn bodyR)] ~ SrcSpanAnnL => StmtLR GhcRn GhcRn bodyR emptyRecStmtId :: Stmt GhcTc (LocatedA (HsCmd GhcTc)) emptyRecStmt :: forall (idL :: Pass) bodyR. Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnL => StmtLR (GhcPass idL) GhcPs bodyR collectStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> [StmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)] collectStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> StmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)] collectPatsBinders :: CollectPass p => CollectFlag p -> [LPat p] -> [IdP p] collectPatBinders :: CollectPass p => CollectFlag p -> LPat p -> [IdP p] -- | Used exclusively for the bindings of an instance decl which are all -- FunBinds collectMethodBinders :: UnXRec idL => LHsBindsLR idL idR -> [LIdP idL] collectLocalBinders :: forall (idL :: Pass) (idR :: Pass). CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] collectLStmtsBinders :: forall (idL :: Pass) (idR :: Pass) body. CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> [LStmtLR (GhcPass idL) (GhcPass idR) body] -> [IdP (GhcPass idL)] collectLStmtBinders :: forall (idL :: Pass) (idR :: Pass) body. CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> LStmtLR (GhcPass idL) (GhcPass idR) body -> [IdP (GhcPass idL)] collectHsValBinders :: forall (idL :: Pass) (idR :: Pass). CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] -- | Collect Id binders only, or Ids + pattern synonyms, -- respectively collectHsIdBinders :: forall (idL :: Pass) (idR :: Pass). CollectPass (GhcPass idL) => CollectFlag (GhcPass idL) -> HsValBindsLR (GhcPass idL) (GhcPass idR) -> [IdP (GhcPass idL)] collectHsBindsBinders :: CollectPass p => CollectFlag p -> LHsBindsLR p idR -> [IdP p] -- | Same as collectHsBindsBinders, but works over a list of -- bindings collectHsBindListBinders :: CollectPass p => CollectFlag p -> [LHsBindLR p idR] -> [IdP p] -- | Collect both Ids and pattern-synonym binders collectHsBindBinders :: CollectPass p => CollectFlag p -> HsBindLR p idR -> [IdP p] -- | Split a list into lists that are small enough to have a corresponding -- tuple arity. The sub-lists of the result all have length <= -- mAX_TUPLE_SIZE But there may be more than mAX_TUPLE_SIZE -- sub-lists chunkify :: [a] -> [[a]] data XXExprGhcTc WrapExpr :: {-# UNPACK #-} !HsWrap HsExpr -> XXExprGhcTc ExpansionExpr :: {-# UNPACK #-} !HsExpansion (HsExpr GhcRn) (HsExpr GhcTc) -> XXExprGhcTc data XBindStmtTc XBindStmtTc :: SyntaxExpr GhcTc -> Type -> Mult -> FailOperator GhcTc -> XBindStmtTc [xbstc_bindOp] :: XBindStmtTc -> SyntaxExpr GhcTc [xbstc_boundResultType] :: XBindStmtTc -> Type [xbstc_boundResultMult] :: XBindStmtTc -> Mult [xbstc_failOp] :: XBindStmtTc -> FailOperator GhcTc data XBindStmtRn XBindStmtRn :: SyntaxExpr GhcRn -> FailOperator GhcRn -> XBindStmtRn [xbsrn_bindOp] :: XBindStmtRn -> SyntaxExpr GhcRn [xbsrn_failOp] :: XBindStmtRn -> FailOperator GhcRn -- | An expression with wrappers, used for rebindable syntax -- -- This should desugar to -- --
-- syn_res_wrap $ syn_expr (syn_arg_wraps[0] arg0) -- (syn_arg_wraps[1] arg1) ... ---- -- where the actual arguments come from elsewhere in the AST. data SyntaxExprTc SyntaxExprTc :: HsExpr GhcTc -> [HsWrapper] -> HsWrapper -> SyntaxExprTc [syn_expr] :: SyntaxExprTc -> HsExpr GhcTc [syn_arg_wraps] :: SyntaxExprTc -> [HsWrapper] [syn_res_wrap] :: SyntaxExprTc -> HsWrapper NoSyntaxExprTc :: SyntaxExprTc -- | The function to use in rebindable syntax. See Note [NoSyntaxExpr]. data SyntaxExprRn SyntaxExprRn :: HsExpr GhcRn -> SyntaxExprRn NoSyntaxExprRn :: SyntaxExprRn type family SyntaxExprGhc (p :: Pass) = (r :: Type) | r -> p -- | Extra data fields for a RecordUpd, added by the type checker data RecordUpdTc RecordUpdTc :: [ConLike] -> [Type] -> [Type] -> HsWrapper -> RecordUpdTc [rupd_cons] :: RecordUpdTc -> [ConLike] [rupd_in_tys] :: RecordUpdTc -> [Type] [rupd_out_tys] :: RecordUpdTc -> [Type] [rupd_wrap] :: RecordUpdTc -> HsWrapper data RecStmtTc RecStmtTc :: Type -> [PostTcExpr] -> [PostTcExpr] -> Type -> RecStmtTc [recS_bind_ty] :: RecStmtTc -> Type [recS_later_rets] :: RecStmtTc -> [PostTcExpr] [recS_rec_rets] :: RecStmtTc -> [PostTcExpr] [recS_ret_ty] :: RecStmtTc -> Type -- | Post-Type checking Table -- -- We use a PostTcTable where there are a bunch of pieces of evidence, -- more than is convenient to keep individually. type PostTcTable = [(Name, PostTcExpr)] -- | Post-Type checking Expression -- -- PostTcExpr is an evidence expression attached to the syntax tree by -- the type checker (c.f. postTcType). type PostTcExpr = HsExpr GhcTc -- | Pending Type-checker Splice data PendingTcSplice PendingTcSplice :: SplicePointName -> LHsExpr GhcTc -> PendingTcSplice -- | Pending Renamer Splice data PendingRnSplice PendingRnSplice :: UntypedSpliceFlavour -> SplicePointName -> LHsExpr GhcRn -> PendingRnSplice -- | HsWrap appears only in typechecker output Invariant: The contained -- Expr is *NOT* itself an HsWrap. See Note [Detecting forced eta -- expansion] in GHC.HsToCore.Expr. This invariant is maintained -- by mkHsWrap. hs_syn is something like HsExpr or HsCmd data HsWrap (hs_syn :: Type -> Type) HsWrap :: HsWrapper -> hs_syn GhcTc -> HsWrap (hs_syn :: Type -> Type) newtype HsSplicedT HsSplicedT :: DelayedSplice -> HsSplicedT data HsExpansion a b HsExpanded :: a -> b -> HsExpansion a b data GrhsAnn GrhsAnn :: Maybe EpaLocation -> AddEpAnn -> GrhsAnn [ga_vbar] :: GrhsAnn -> Maybe EpaLocation -- | Match separator location [ga_sep] :: GrhsAnn -> AddEpAnn data EpAnnUnboundVar EpAnnUnboundVar :: (EpaLocation, EpaLocation) -> EpaLocation -> EpAnnUnboundVar [hsUnboundBackquotes] :: EpAnnUnboundVar -> (EpaLocation, EpaLocation) [hsUnboundHole] :: EpAnnUnboundVar -> EpaLocation data EpAnnHsCase EpAnnHsCase :: EpaLocation -> EpaLocation -> [AddEpAnn] -> EpAnnHsCase [hsCaseAnnCase] :: EpAnnHsCase -> EpaLocation [hsCaseAnnOf] :: EpAnnHsCase -> EpaLocation [hsCaseAnnsRest] :: EpAnnHsCase -> [AddEpAnn] data DelayedSplice DelayedSplice :: TcLclEnv -> LHsExpr GhcRn -> TcType -> LHsExpr GhcTc -> DelayedSplice data CmdTopTc CmdTopTc :: Type -> Type -> CmdSyntaxTable GhcTc -> CmdTopTc data AnnsLet AnnsLet :: EpaLocation -> EpaLocation -> AnnsLet [alLet] :: AnnsLet -> EpaLocation [alIn] :: AnnsLet -> EpaLocation data AnnsIf AnnsIf :: EpaLocation -> EpaLocation -> EpaLocation -> Maybe EpaLocation -> Maybe EpaLocation -> AnnsIf [aiIf] :: AnnsIf -> EpaLocation [aiThen] :: AnnsIf -> EpaLocation [aiElse] :: AnnsIf -> EpaLocation [aiThenSemi] :: AnnsIf -> Maybe EpaLocation [aiElseSemi] :: AnnsIf -> Maybe EpaLocation data AnnProjection AnnProjection :: EpaLocation -> EpaLocation -> AnnProjection -- | '(' [apOpen] :: AnnProjection -> EpaLocation -- | ')' [apClose] :: AnnProjection -> EpaLocation data AnnFieldLabel AnnFieldLabel :: Maybe EpaLocation -> AnnFieldLabel [afDot] :: AnnFieldLabel -> Maybe EpaLocation data AnnExplicitSum AnnExplicitSum :: EpaLocation -> [EpaLocation] -> [EpaLocation] -> EpaLocation -> AnnExplicitSum [aesOpen] :: AnnExplicitSum -> EpaLocation [aesBarsBefore] :: AnnExplicitSum -> [EpaLocation] [aesBarsAfter] :: AnnExplicitSum -> [EpaLocation] [aesClose] :: AnnExplicitSum -> EpaLocation tupArgPresent :: forall (p :: Pass). HsTupArg (GhcPass p) -> Bool thTyBrackets :: SDoc -> SDoc thBrackets :: SDoc -> SDoc -> SDoc stripParensLHsExpr :: forall (p :: Pass). LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) stripParensHsExpr :: forall (p :: Pass). HsExpr (GhcPass p) -> HsExpr (GhcPass p) ppr_splice_decl :: forall (p :: Pass). OutputableBndrId p => HsSplice (GhcPass p) -> SDoc ppr_splice :: forall (p :: Pass). OutputableBndrId p => SDoc -> IdP (GhcPass p) -> LHsExpr (GhcPass p) -> SDoc -> SDoc ppr_quasi :: OutputableBndr p => p -> p -> FastString -> SDoc ppr_module_name_prefix :: Maybe ModuleName -> SDoc ppr_lexpr :: forall (p :: Pass). OutputableBndrId p => LHsExpr (GhcPass p) -> SDoc ppr_lcmd :: forall (p :: Pass). OutputableBndrId p => LHsCmd (GhcPass p) -> SDoc ppr_infix_expr :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> Maybe SDoc ppr_expr :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> SDoc ppr_do_stmts :: forall (idL :: Pass) (idR :: Pass) body. (OutputableBndrId idL, OutputableBndrId idR, Anno (StmtLR (GhcPass idL) (GhcPass idR) body) ~ SrcSpanAnnA, Outputable body) => [LStmtLR (GhcPass idL) (GhcPass idR) body] -> SDoc ppr_cmd :: forall (p :: Pass). OutputableBndrId p => HsCmd (GhcPass p) -> SDoc ppr_apps :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> [Either (LHsExpr (GhcPass p)) (LHsWcType (NoGhcTc (GhcPass p)))] -> SDoc pprTransformStmt :: forall (p :: Pass). OutputableBndrId p => [IdP (GhcPass p)] -> LHsExpr (GhcPass p) -> Maybe (LHsExpr (GhcPass p)) -> SDoc pprTransStmt :: Outputable body => Maybe body -> body -> TransForm -> SDoc pprStmtInCtxt :: forall (idL :: Pass) (idR :: Pass) body. (OutputableBndrId idL, OutputableBndrId idR, Outputable body, Anno (StmtLR (GhcPass idL) (GhcPass idR) body) ~ SrcSpanAnnA) => HsStmtContext (GhcPass idL) -> StmtLR (GhcPass idL) (GhcPass idR) body -> SDoc pprStmt :: forall (idL :: Pass) (idR :: Pass) body. (OutputableBndrId idL, OutputableBndrId idR, Anno (StmtLR (GhcPass idL) (GhcPass idR) body) ~ SrcSpanAnnA, Outputable body) => StmtLR (GhcPass idL) (GhcPass idR) body -> SDoc pprQuals :: forall (p :: Pass) body. (OutputableBndrId p, Outputable body, Anno (StmtLR (GhcPass p) (GhcPass p) body) ~ SrcSpanAnnA) => [LStmt (GhcPass p) body] -> SDoc pprPendingSplice :: forall (p :: Pass). OutputableBndrId p => SplicePointName -> LHsExpr (GhcPass p) -> SDoc pprParendLExpr :: forall (p :: Pass). OutputableBndrId p => PprPrec -> LHsExpr (GhcPass p) -> SDoc pprParendExpr :: forall (p :: Pass). OutputableBndrId p => PprPrec -> HsExpr (GhcPass p) -> SDoc pprMatches :: forall (idR :: Pass) body. (OutputableBndrId idR, Outputable body) => MatchGroup (GhcPass idR) body -> SDoc pprMatchInCtxt :: forall (idR :: Pass) body. (OutputableBndrId idR, Outputable body) => Match (GhcPass idR) body -> SDoc pprMatch :: forall (idR :: Pass) body. (OutputableBndrId idR, Outputable body) => Match (GhcPass idR) body -> SDoc pprLCmd :: forall (p :: Pass). OutputableBndrId p => LHsCmd (GhcPass p) -> SDoc pprHsBracket :: forall (p :: Pass). OutputableBndrId p => HsBracket (GhcPass p) -> SDoc pprGRHSs :: forall (idR :: Pass) body passL. (OutputableBndrId idR, Outputable body) => HsMatchContext passL -> GRHSs (GhcPass idR) body -> SDoc pprGRHS :: forall (idR :: Pass) body passL. (OutputableBndrId idR, Outputable body) => HsMatchContext passL -> GRHS (GhcPass idR) body -> SDoc pprDo :: forall (p :: Pass) body any. (OutputableBndrId p, Outputable body, Anno (StmtLR (GhcPass p) (GhcPass p) body) ~ SrcSpanAnnA) => HsStmtContext any -> [LStmt (GhcPass p) body] -> SDoc pprDebugParendExpr :: forall (p :: Pass). OutputableBndrId p => PprPrec -> LHsExpr (GhcPass p) -> SDoc pprComp :: forall (p :: Pass) body. (OutputableBndrId p, Outputable body, Anno (StmtLR (GhcPass p) (GhcPass p) body) ~ SrcSpanAnnA) => [LStmt (GhcPass p) body] -> SDoc pprCmdArg :: forall (p :: Pass). OutputableBndrId p => HsCmdTop (GhcPass p) -> SDoc pprCmd :: forall (p :: Pass). OutputableBndrId p => HsCmd (GhcPass p) -> SDoc pprBy :: Outputable body => Maybe body -> SDoc pprBinds :: forall (idL :: Pass) (idR :: Pass). (OutputableBndrId idL, OutputableBndrId idR) => HsLocalBindsLR (GhcPass idL) (GhcPass idR) -> SDoc pprBindStmt :: (Outputable pat, Outputable expr) => pat -> expr -> SDoc pprArg :: forall (idL :: Pass). OutputableBndrId idL => ApplicativeArg (GhcPass idL) -> SDoc pp_rhs :: Outputable body => HsMatchContext passL -> body -> SDoc pp_dotdot :: SDoc -- | parenthesizeHsExpr p e checks if -- hsExprNeedsParens p e is true, and if so, surrounds -- e with an HsPar. Otherwise, it simply returns -- e. parenthesizeHsExpr :: forall (p :: Pass). IsPass p => PprPrec -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) noSyntaxExpr :: forall (p :: Pass). IsPass p => SyntaxExpr (GhcPass p) -- | This is used for rebindable-syntax pieces that are too polymorphic for -- tcSyntaxOp (trS_fmap and the mzip in ParStmt) noExpr :: forall (p :: Pass). HsExpr (GhcPass p) -- | Make a 'SyntaxExpr GhcRn' from an expression Used only in -- getMonadFailOp. See Note [Monad fail : Rebindable syntax, overloaded -- strings] in GHC.Rename.Expr mkSyntaxExpr :: HsExpr GhcRn -> SyntaxExprRn -- | Make a SyntaxExpr from a Name (the "rn" is because this -- is used in the renamer). mkRnSyntaxExpr :: Name -> SyntaxExprRn matchGroupArity :: forall (id :: Pass) body. MatchGroup (GhcPass id) body -> Arity matchContextErrString :: forall (p :: Pass). OutputableBndrId p => HsMatchContext (GhcPass p) -> SDoc matchArrowContextErrString :: HsArrowMatchContext -> SDoc -- | Is there only one RHS in this list of matches? isSingletonMatchGroup :: forall (p :: Pass) body. [LMatch (GhcPass p) body] -> Bool isQuietHsExpr :: HsExpr id -> Bool isQuietHsCmd :: HsCmd id -> Bool isEmptyMatchGroup :: forall (p :: Pass) body. MatchGroup (GhcPass p) body -> Bool isAtomicHsExpr :: forall (p :: Pass). IsPass p => HsExpr (GhcPass p) -> Bool hsLMatchPats :: forall (id :: Pass) body. LMatch (GhcPass id) body -> [LPat (GhcPass id)] -- | hsExprNeedsParens p e returns True if the -- expression e needs parentheses under precedence p. hsExprNeedsParens :: forall (p :: Pass). IsPass p => PprPrec -> HsExpr (GhcPass p) -> Bool data NHsValBindsLR idL NValBinds :: [(RecFlag, LHsBinds idL)] -> [LSig GhcRn] -> NHsValBindsLR idL data AnnSig AnnSig :: AddEpAnn -> [AddEpAnn] -> AnnSig [asDcolon] :: AnnSig -> AddEpAnn [asRest] :: AnnSig -> [AddEpAnn] -- | Using SourceText in case the pragma was spelled differently or used -- mixed case pragSrcBrackets :: SourceText -> String -> SDoc -> SDoc pragBrackets :: SDoc -> SDoc ppr_sig :: forall (p :: Pass). OutputableBndrId p => Sig (GhcPass p) -> SDoc ppr_monobind :: forall (idL :: Pass) (idR :: Pass). (OutputableBndrId idL, OutputableBndrId idR) => HsBindLR (GhcPass idL) (GhcPass idR) -> SDoc pprVarSig :: OutputableBndr id => [id] -> SDoc -> SDoc pprTicks :: SDoc -> SDoc -> SDoc pprTcSpecPrags :: TcSpecPrags -> SDoc pprSpec :: OutputableBndr id => id -> SDoc -> InlinePragma -> SDoc pprMinimalSig :: OutputableBndr name => LBooleanFormula (GenLocated l name) -> SDoc pprLHsBindsForUser :: forall (idL :: Pass) (idR :: Pass) (id2 :: Pass). (OutputableBndrId idL, OutputableBndrId idR, OutputableBndrId id2) => LHsBindsLR (GhcPass idL) (GhcPass idR) -> [LSig (GhcPass id2)] -> [SDoc] pprLHsBinds :: forall (idL :: Pass) (idR :: Pass). (OutputableBndrId idL, OutputableBndrId idR) => LHsBindsLR (GhcPass idL) (GhcPass idR) -> SDoc pprDeclList :: [SDoc] -> SDoc plusHsValBinds :: forall (a :: Pass). HsValBinds (GhcPass a) -> HsValBinds (GhcPass a) -> HsValBinds (GhcPass a) isEmptyValBinds :: forall (a :: Pass) (b :: Pass). HsValBindsLR (GhcPass a) (GhcPass b) -> Bool isEmptyLHsBinds :: forall (idL :: Pass) idR. LHsBindsLR (GhcPass idL) idR -> Bool isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool isEmptyIPBindsPR :: forall (p :: Pass). HsIPBinds (GhcPass p) -> Bool eqEmptyLocalBinds :: HsLocalBindsLR a b -> Bool emptyValBindsOut :: forall (a :: Pass) (b :: Pass). HsValBindsLR (GhcPass a) (GhcPass b) emptyValBindsIn :: forall (a :: Pass) (b :: Pass). HsValBindsLR (GhcPass a) (GhcPass b) emptyLocalBinds :: forall (a :: Pass) (b :: Pass). HsLocalBindsLR (GhcPass a) (GhcPass b) emptyLHsBinds :: forall (idL :: Pass) idR. LHsBindsLR (GhcPass idL) idR mkHsAppTy :: forall (p :: Pass). LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) mkHsAppKindTy :: forall (p :: Pass). XAppKindTy (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) -> LHsType (GhcPass p) pprSpliceDecl :: forall (p :: Pass). OutputableBndrId p => HsSplice (GhcPass p) -> SpliceExplicitFlag -> SDoc pprSplice :: forall (p :: Pass). OutputableBndrId p => HsSplice (GhcPass p) -> SDoc pprPatBind :: forall (bndr :: Pass) (p :: Pass). (OutputableBndrId bndr, OutputableBndrId p) => LPat (GhcPass bndr) -> GRHSs (GhcPass p) (LHsExpr (GhcPass p)) -> SDoc pprLExpr :: forall (p :: Pass). OutputableBndrId p => LHsExpr (GhcPass p) -> SDoc pprFunBind :: forall (idR :: Pass). OutputableBndrId idR => MatchGroup (GhcPass idR) (LHsExpr (GhcPass idR)) -> SDoc pprExpr :: forall (p :: Pass). OutputableBndrId p => HsExpr (GhcPass p) -> SDoc data UntypedSpliceFlavour UntypedExpSplice :: UntypedSpliceFlavour UntypedPatSplice :: UntypedSpliceFlavour UntypedTypeSplice :: UntypedSpliceFlavour UntypedDeclSplice :: UntypedSpliceFlavour data TransForm ThenForm :: TransForm GroupForm :: TransForm -- | Finalizers produced by a splice with addModFinalizer -- -- See Note [Delaying modFinalizers in untyped splices] in -- GHC.Rename.Splice. For how this is used. newtype ThModFinalizers ThModFinalizers :: [ForeignRef (Q ())] -> ThModFinalizers -- | Exact print annotations when in qualifier lists or guards - -- AnnKeywordId : AnnVbar, AnnComma,AnnThen, -- AnnBy,AnnBy, AnnGroup,AnnUsing data StmtLR idL idR body LastStmt :: XLastStmt idL idR body -> body -> Maybe Bool -> SyntaxExpr idR -> StmtLR idL idR body BindStmt :: XBindStmt idL idR body -> LPat idL -> body -> StmtLR idL idR body -- | ApplicativeStmt represents an applicative expression built with -- <$> and <*>. It is generated by the renamer, -- and is desugared into the appropriate applicative expression by the -- desugarer, but it is intended to be invisible in error messages. -- -- For full details, see Note [ApplicativeDo] in GHC.Rename.Expr ApplicativeStmt :: XApplicativeStmt idL idR body -> [(SyntaxExpr idR, ApplicativeArg idL)] -> Maybe (SyntaxExpr idR) -> StmtLR idL idR body BodyStmt :: XBodyStmt idL idR body -> body -> SyntaxExpr idR -> SyntaxExpr idR -> StmtLR idL idR body -- |
-- type/data family T :: *->* ---- --
-- newtype Blah ... --NewType :: NewOrData -- |
-- data Blah ... --DataType :: NewOrData -- | Located Warning Declarations type LWarnDecls pass = XRec pass WarnDecls pass -- | Located Warning pragma Declaration type LWarnDecl pass = XRec pass WarnDecl pass -- | Located Type Family Instance Equation type LTyFamInstEqn pass = XRec pass TyFamInstEqn pass -- | Located Type Family Instance Declaration type LTyFamInstDecl pass = XRec pass TyFamInstDecl pass -- | Located type family default declarations. type LTyFamDefltDecl pass = XRec pass TyFamDefltDecl pass -- | Located Declaration of a Type or Class type LTyClDecl pass = XRec pass TyClDecl pass -- | Located Standalone Kind Signature type LStandaloneKindSig pass = XRec pass StandaloneKindSig pass -- | Located Splice Declaration type LSpliceDecl pass = XRec pass SpliceDecl pass -- | Located Rule Declarations type LRuleDecls pass = XRec pass RuleDecls pass -- | Located Rule Declaration type LRuleDecl pass = XRec pass RuleDecl pass -- | Located Rule Binder type LRuleBndr pass = XRec pass RuleBndr pass -- | Located Role Annotation Declaration type LRoleAnnotDecl pass = XRec pass RoleAnnotDecl pass -- | Located Instance Declaration type LInstDecl pass = XRec pass InstDecl pass -- | Located Injectivity Annotation type LInjectivityAnn pass = XRec pass InjectivityAnn pass type LHsFunDep pass = XRec pass FunDep pass type LHsDerivingClause pass = XRec pass HsDerivingClause pass type LHsDecl p = XRec p HsDecl p -- | Located Foreign Declaration type LForeignDecl pass = XRec pass ForeignDecl pass -- | Located type Family Result Signature type LFamilyResultSig pass = XRec pass FamilyResultSig pass -- | Located type Family Declaration type LFamilyDecl pass = XRec pass FamilyDecl pass -- | Located Documentation comment Declaration type LDocDecl pass = XRec pass DocDecl -- | A Located DerivStrategy. type LDerivStrategy pass = XRec pass DerivStrategy pass -- | Located stand-alone 'deriving instance' declaration type LDerivDecl pass = XRec pass DerivDecl pass type LDerivClauseTys pass = XRec pass DerivClauseTys pass -- | Located Default Declaration type LDefaultDecl pass = XRec pass DefaultDecl pass -- | Located Data Family Instance Declaration type LDataFamInstDecl pass = XRec pass DataFamInstDecl pass -- | Located data Constructor Declaration type LConDecl pass = XRec pass ConDecl pass -- | Located Class Instance Declaration type LClsInstDecl pass = XRec pass ClsInstDecl pass -- | Located Annotation Declaration type LAnnDecl pass = XRec pass AnnDecl pass -- | Instance Declaration data InstDecl pass ClsInstD :: XClsInstD pass -> ClsInstDecl pass -> InstDecl pass [cid_d_ext] :: InstDecl pass -> XClsInstD pass [cid_inst] :: InstDecl pass -> ClsInstDecl pass DataFamInstD :: XDataFamInstD pass -> DataFamInstDecl pass -> InstDecl pass [dfid_ext] :: InstDecl pass -> XDataFamInstD pass [dfid_inst] :: InstDecl pass -> DataFamInstDecl pass TyFamInstD :: XTyFamInstD pass -> TyFamInstDecl pass -> InstDecl pass [tfid_ext] :: InstDecl pass -> XTyFamInstD pass [tfid_inst] :: InstDecl pass -> TyFamInstDecl pass XInstDecl :: !XXInstDecl pass -> InstDecl pass -- | If the user supplied an injectivity annotation it is represented using -- InjectivityAnn. At the moment this is a single injectivity condition - -- see Note [Injectivity annotation]. `Located name` stores the LHS of -- injectivity condition. `[Located name]` stores the RHS of injectivity -- condition. Example: -- -- type family Foo a b c = r | r -> a c where ... -- -- This will be represented as "InjectivityAnn r [a, -- c]" data InjectivityAnn pass -- |
-- -XDeriveAnyClass --AnyclassStrategy :: XAnyClassStrategy pass -> DerivStrategy pass -- |
-- -XGeneralizedNewtypeDeriving --NewtypeStrategy :: XNewtypeStrategy pass -> DerivStrategy pass -- |
-- -XDerivingVia --ViaStrategy :: XViaStrategy pass -> DerivStrategy pass -- | Stand-alone 'deriving instance' declaration data DerivDecl pass DerivDecl :: XCDerivDecl pass -> LHsSigWcType pass -> Maybe (LDerivStrategy pass) -> Maybe (XRec pass OverlapMode) -> DerivDecl pass [deriv_ext] :: DerivDecl pass -> XCDerivDecl pass -- | The instance type to derive. -- -- It uses an LHsSigWcType because the context is allowed to be a -- single wildcard: -- --
-- deriving instance _ => Eq (Foo a) ---- -- Which signifies that the context should be inferred. [deriv_type] :: DerivDecl pass -> LHsSigWcType pass [deriv_strategy] :: DerivDecl pass -> Maybe (LDerivStrategy pass) -- |
-- data T b = ... deriving (C [a]) ---- -- should produce a derived instance for C [a] (T b). data DerivClauseTys pass -- | A deriving clause with a single type. Moreover, that type can -- only be a type constructor without any arguments. -- -- Example: deriving Eq DctSingle :: XDctSingle pass -> LHsSigType pass -> DerivClauseTys pass -- | A deriving clause with a comma-separated list of types, -- surrounded by enclosing parentheses. -- -- Example: deriving (Eq, C a) DctMulti :: XDctMulti pass -> [LHsSigType pass] -> DerivClauseTys pass XDerivClauseTys :: !XXDerivClauseTys pass -> DerivClauseTys pass -- | Default Declaration data DefaultDecl pass -- |
-- data T b = forall a. Eq a => MkT a b -- MkT :: forall b a. Eq a => MkT a b -- -- data T b where -- MkT1 :: Int -> T Int -- -- data T = Int MkT Int -- | MkT2 -- -- data T a where -- Int MkT Int :: T Int ---- --
-- f :: Num a => a -> a ---- -- After renaming, this list of Names contains the named wildcards -- brought into scope by this signature. For a signature _ -> _a -- -> Bool, the renamer will leave the unnamed wildcard -- _ untouched, and the named wildcard _a is then -- replaced with fresh meta vars in the type. Their names are stored in -- the type signature that brought them into scope, in this third field -- to be more specific. -- --
-- pattern Single :: () => (Show a) => a -> [a] ---- --
-- infixl 8 *** ---- --
-- {#- INLINE f #-}
--
--
--
-- {-# SPECIALISE f :: Int -> Int #-}
--
--
--
-- {-# SPECIALISE instance Eq [Int] #-}
--
--
-- (Class tys); should be a specialisation of the current instance
-- declaration
--
--
-- {-# MINIMAL a | (b, c | (d | e)) #-}
--
--
--
-- {-# SCC funName #-}
--
--
-- or
--
--
-- {-# SCC funName "cost_centre_name" #-}
--
SCCFunSig :: XSCCFunSig pass -> SourceText -> LIdP pass -> Maybe (XRec pass StringLiteral) -> Sig pass
-- | A complete match pragma
--
--
-- {-# COMPLETE C, D [:: T] #-}
--
--
-- Used to inform the pattern match checker about additional complete
-- matchings which, for example, arise from pattern synonym definitions.
CompleteMatchSig :: XCompleteMatchSig pass -> SourceText -> XRec pass [LIdP pass] -> Maybe (LIdP pass) -> Sig pass
XSig :: !XXSig pass -> Sig pass
-- | Record Pattern Synonym Field
data RecordPatSynField pass
RecordPatSynField :: FieldOcc pass -> LIdP pass -> RecordPatSynField pass
-- | Field label visible in rest of the file
[recordPatSynField] :: RecordPatSynField pass -> FieldOcc pass
-- | Filled in by renamer, the name used internally by the pattern
[recordPatSynPatVar] :: RecordPatSynField pass -> LIdP pass
-- | -- f :: Int -> forall a. a -> a -- f x y = y ---- -- Then the MatchGroup will have type (Int -> a' -> a') (with a -- free type variable a'). The coercion will take a CoreExpr of this type -- and convert it to a CoreExpr of type Int -> forall a'. a' -> a' -- Notice that the coercion captures the free a'. [fun_ext] :: HsBindLR idL idR -> XFunBind idL idR [fun_id] :: HsBindLR idL idR -> LIdP idL -- | The payload [fun_matches] :: HsBindLR idL idR -> MatchGroup idR (LHsExpr idR) -- | Ticks to put on the rhs, if any [fun_tick] :: HsBindLR idL idR -> [CoreTickish] -- | Pattern Binding -- -- The pattern is never a simple variable; That case is done by FunBind. -- See Note [FunBind vs PatBind] for details about the relationship -- between FunBind and PatBind. PatBind :: XPatBind idL idR -> LPat idL -> GRHSs idR (LHsExpr idR) -> ([CoreTickish], [[CoreTickish]]) -> HsBindLR idL idR -- | See Note [Bind free vars] [pat_ext] :: HsBindLR idL idR -> XPatBind idL idR [pat_lhs] :: HsBindLR idL idR -> LPat idL [pat_rhs] :: HsBindLR idL idR -> GRHSs idR (LHsExpr idR) -- | Ticks to put on the rhs, if any, and ticks to put on the bound -- variables. [pat_ticks] :: HsBindLR idL idR -> ([CoreTickish], [[CoreTickish]]) -- | Variable Binding -- -- Dictionary binding and suchlike. All VarBinds are introduced by the -- type checker VarBind :: XVarBind idL idR -> IdP idL -> LHsExpr idR -> HsBindLR idL idR [var_ext] :: HsBindLR idL idR -> XVarBind idL idR [var_id] :: HsBindLR idL idR -> IdP idL -- | Located only for consistency [var_rhs] :: HsBindLR idL idR -> LHsExpr idR -- | Abstraction Bindings AbsBinds :: XAbsBinds idL idR -> [TyVar] -> [EvVar] -> [ABExport idL] -> [TcEvBinds] -> LHsBinds idL -> Bool -> HsBindLR idL idR [abs_ext] :: HsBindLR idL idR -> XAbsBinds idL idR [abs_tvs] :: HsBindLR idL idR -> [TyVar] -- | Includes equality constraints [abs_ev_vars] :: HsBindLR idL idR -> [EvVar] -- | AbsBinds only gets used when idL = idR after renaming, but these need -- to be idL's for the collect... code in HsUtil to have the right type [abs_exports] :: HsBindLR idL idR -> [ABExport idL] -- | Evidence bindings Why a list? See GHC.Tc.TyCl.Instance Note -- [Typechecking plan for instance declarations] [abs_ev_binds] :: HsBindLR idL idR -> [TcEvBinds] -- | Typechecked user bindings [abs_binds] :: HsBindLR idL idR -> LHsBinds idL [abs_sig] :: HsBindLR idL idR -> Bool -- | Patterns Synonym Binding PatSynBind :: XPatSynBind idL idR -> PatSynBind idL idR -> HsBindLR idL idR XHsBindsLR :: !XXHsBindsLR idL idR -> HsBindLR idL idR -- | Haskell Binding type HsBind id = HsBindLR id id -- | Fixity Signature data FixitySig pass FixitySig :: XFixitySig pass -> [LIdP pass] -> Fixity -> FixitySig pass XFixitySig :: !XXFixitySig pass -> FixitySig pass -- | Abstraction Bindings Export data ABExport p ABE :: XABE p -> IdP p -> IdP p -> HsWrapper -> TcSpecPrags -> ABExport p [abe_ext] :: ABExport p -> XABE p -- | Any INLINE pragma is attached to this Id [abe_poly] :: ABExport p -> IdP p [abe_mono] :: ABExport p -> IdP p -- | See Note [ABExport wrapper] Shape: (forall abs_tvs. abs_ev_vars => -- abe_mono) ~ abe_poly [abe_wrap] :: ABExport p -> HsWrapper -- | SPECIALISE pragmas [abe_prags] :: ABExport p -> TcSpecPrags XABExport :: !XXABExport p -> ABExport p noSpecPrags :: TcSpecPrags isTypeLSig :: UnXRec p => LSig p -> Bool isSpecLSig :: UnXRec p => LSig p -> Bool isSpecInstLSig :: UnXRec p => LSig p -> Bool isSCCFunSig :: UnXRec p => LSig p -> Bool isPragLSig :: UnXRec p => LSig p -> Bool isMinimalLSig :: UnXRec p => LSig p -> Bool isInlineLSig :: UnXRec p => LSig p -> Bool isFixityLSig :: UnXRec p => LSig p -> Bool isDefaultMethod :: TcSpecPrags -> Bool isCompleteMatchSig :: UnXRec p => LSig p -> Bool hsSigDoc :: Sig name -> SDoc hasSpecPrags :: TcSpecPrags -> Bool -- | Located Haskell Record Update Field type LHsRecUpdField p = XRec p HsRecUpdField p -- | Located Haskell Record Field type LHsRecField' p id arg = XRec p HsRecField' id arg -- | Located Haskell Record Field type LHsRecField p arg = XRec p HsRecField p arg -- | Haskell Record Update Field type HsRecUpdField p = HsRecField' AmbiguousFieldOcc p LHsExpr p -- | Haskell Record Fields -- -- HsRecFields is used only for patterns and expressions (not data type -- declarations) data HsRecFields p arg HsRecFields :: [LHsRecField p arg] -> Maybe (Located Int) -> HsRecFields p arg [rec_flds] :: HsRecFields p arg -> [LHsRecField p arg] [rec_dotdot] :: HsRecFields p arg -> Maybe (Located Int) -- | Haskell Record Field -- --
-- (?x :: ty) ---- --
-- (ty :: kind) ---- --
-- f :: forall a {b}. blah
--
--
-- We use Specificity for the HsOuterTyVarBndrs
-- flag to allow distinguishing between specified and inferred
-- type variables.
type HsOuterSigTyVarBndrs = HsOuterTyVarBndrs Specificity
-- | Used for type-family instance equations, e.g.,
--
-- -- type instance forall a. F [a] = Tree a ---- -- The notion of specificity is irrelevant in type family equations, so -- we use () for the HsOuterTyVarBndrs flag. type HsOuterFamEqnTyVarBndrs = HsOuterTyVarBndrs () -- | Haskell Kind type HsKind pass = HsType pass -- | These names are used early on to store the names of implicit -- parameters. They completely disappear after type-checking. newtype HsIPName HsIPName :: FastString -> HsIPName -- | The type variable binders in an HsForAllTy. See also Note -- [Variable Specificity and Forall Visibility] in -- GHC.Tc.Gen.HsType. data HsForAllTelescope pass -- | A visible forall (e.g., forall a -> {...}). These -- do not have any notion of specificity, so we use () as a -- placeholder value. HsForAllVis :: XHsForAllVis pass -> [LHsTyVarBndr () pass] -> HsForAllTelescope pass [hsf_xvis] :: HsForAllTelescope pass -> XHsForAllVis pass [hsf_vis_bndrs] :: HsForAllTelescope pass -> [LHsTyVarBndr () pass] -- | An invisible forall (e.g., forall a {b} c. {...}), -- where each binder has a Specificity. HsForAllInvis :: XHsForAllInvis pass -> [LHsTyVarBndr Specificity pass] -> HsForAllTelescope pass [hsf_xinvis] :: HsForAllTelescope pass -> XHsForAllInvis pass [hsf_invis_bndrs] :: HsForAllTelescope pass -> [LHsTyVarBndr Specificity pass] XHsForAllTelescope :: !XXHsForAllTelescope pass -> HsForAllTelescope pass type HsCoreTy = Type -- | Haskell Context type HsContext pass = [LHsType pass] -- | Describes the arguments to a data constructor. This is a common -- representation for several constructor-related concepts, including: -- --
-- SynAny `SynFun` (SynList `SynFun` SynType Int) `SynFun` SynAny ---- -- you'll get three types back: one for the first SynAny, the -- element type of the list, and one for the last SynAny. -- You don't get anything for the SynType, because you've said -- positively that it should be an Int, and so it shall be. -- -- You'll also get three multiplicities back: one for each function -- arrow. See also Note [Linear types] in Multiplicity. -- -- This is defined here to avoid defining it in GHC.Tc.Gen.Expr -- boot file. data SyntaxOpType -- | Any type SynAny :: SyntaxOpType -- | A rho type, skolemised or instantiated as appropriate SynRho :: SyntaxOpType -- | A list type. You get back the element type of the list SynList :: SyntaxOpType -- | A function. SynFun :: SyntaxOpType -> SyntaxOpType -> SyntaxOpType -- | A known type. SynType :: ExpType -> SyntaxOpType infixr 0 `SynFun` data MetaInfo TauTv :: MetaInfo TyVarTv :: MetaInfo RuntimeUnkTv :: MetaInfo CycleBreakerTv :: MetaInfo data InferResult IR :: Unique -> TcLevel -> IORef (Maybe TcType) -> InferResult [ir_uniq] :: InferResult -> Unique [ir_lvl] :: InferResult -> TcLevel [ir_ref] :: InferResult -> IORef (Maybe TcType) -- | An expected type to check against during type-checking. See Note -- [ExpType] in GHC.Tc.Utils.TcMType, where you'll also find -- manipulators. data ExpType Check :: TcType -> ExpType Infer :: !InferResult -> ExpType type ExpSigmaType = ExpType type ExpRhoType = ExpType transSuperClasses :: PredType -> [PredType] topTcLevel :: TcLevel tcTypeLevel :: TcType -> TcLevel tcTyVarLevel :: TcTyVar -> TcLevel -- | Like tcTyFamInsts, except that the output records whether the -- type family and its arguments occur as an invisible argument in -- some type application. This information is useful because it helps GHC -- know when to turn on -fprint-explicit-kinds during error -- reporting so that users can actually see the type family being -- mentioned. -- -- As an example, consider: -- --
-- class C a -- data T (a :: k) -- type family F a :: k -- instance C (T @(F Int) (F Bool)) ---- -- There are two occurrences of the type family F in that -- C instance, so tcTyFamInstsAndVis (C (T @(F Int) -- (F Bool))) will return: -- --
-- [ (True, F, [Int]) -- , (False, F, [Bool]) ] ---- -- F Int is paired with True since it appears as an -- invisible argument to C, whereas F Bool is -- paired with False since it appears an a visible argument -- to C. -- -- See also Note [Kind arguments in error messages] in -- GHC.Tc.Errors. tcTyFamInstsAndVis :: Type -> [(Bool, TyCon, [Type])] -- | Finds outermost type-family applications occurring in a type, after -- expanding synonyms. In the list (F, tys) that is returned we guarantee -- that tys matches F's arity. For example, given type family F a :: * -- -> * (arity 1) calling tcTyFamInsts on (Maybe (F Int Bool) will -- return (F, [Int]), not (F, [Int,Bool]) -- -- This is important for its use in deciding termination of type -- instances (see #11581). E.g. type instance G [Int] = ...(F Int <big -- type>)... we don't need to take <big type> into account when -- asking if the calls on the RHS are smaller than the LHS tcTyFamInsts :: Type -> [(TyCon, [Type])] -- | For every arg a tycon can take, the returned list says True if the -- argument is taken visibly, and False otherwise. Ends with an infinite -- tail of Trues to allow for oversaturation. tcTyConVisibilities :: TyCon -> [Bool] -- | In an application of a TyCon to some arguments, find the -- outermost occurrences of type family applications within the -- arguments. This function will not consider the TyCon itself -- when checking for type family applications. -- -- See tcTyFamInstsAndVis for more details on how this works (as -- this function is called inside of tcTyFamInstsAndVis). tcTyConAppTyFamInstsAndVis :: TyCon -> [Type] -> [(Bool, TyCon, [Type])] -- | Like tcRepSplitTyConApp_maybe, but only returns the -- TyCon. tcTyConAppTyCon_maybe :: Type -> Maybe TyCon tcTyConAppTyCon :: Type -> TyCon tcTyConAppArgs :: Type -> [Type] tcSplitTyConApp :: Type -> (TyCon, [Type]) -- | Like tcSplitForAllTyVars, but only splits a ForAllTy if -- argf_pred argf is True, where argf is the -- visibility of the ForAllTy's binder and argf_pred is -- a predicate over visibilities provided as an argument to this -- function. tcSplitSomeForAllTyVars :: (ArgFlag -> Bool) -> Type -> ([TyVar], Type) -- | Split a sigma type into its parts. This only splits invisible -- type variable binders, as these are the only forms of binder that the -- typechecker will implicitly instantiate. tcSplitSigmaTy :: Type -> ([TyVar], ThetaType, Type) tcSplitPredFunTy_maybe :: Type -> Maybe (PredType, Type) -- | Splits a forall type into a list of TyBinders and the inner -- type. Always succeeds, even if it returns an empty list. tcSplitPiTys :: Type -> ([TyBinder], Type) -- | Splits a type into a TyBinder and a body, if possible. Panics -- otherwise tcSplitPiTy_maybe :: Type -> Maybe (TyBinder, Type) tcSplitPhiTy :: Type -> (ThetaType, Type) -- | Split a sigma type into its parts, going underneath as many arrows and -- foralls as possible. See Note [tcSplitNestedSigmaTys] tcSplitNestedSigmaTys :: Type -> ([TyVar], ThetaType, Type) tcSplitMethodTy :: Type -> ([TyVar], PredType, Type) tcSplitIOType_maybe :: Type -> Maybe (TyCon, Type) -- | Split off exactly the specified number argument types Returns (Left m) -- if there are m missing arrows in the type (Right (tys,res)) -- if the type looks like t1 -> ... -> tn -> res tcSplitFunTysN :: Arity -> TcRhoType -> Either Arity ([Scaled TcSigmaType], TcSigmaType) tcSplitFunTys :: Type -> ([Scaled Type], Type) tcSplitFunTy_maybe :: Type -> Maybe (Scaled Type, Type) -- | Like tcSplitPiTys, but splits off only named binders, returning -- just the tyvars. tcSplitForAllTyVars :: Type -> ([TyVar], Type) -- | Like tcSplitForAllTyVars, but splits off only named binders. tcSplitForAllTyVarBinders :: Type -> ([TyVarBinder], Type) tcSplitForAllTyVarBinder_maybe :: Type -> Maybe (TyVarBinder, Type) -- | Like tcSplitForAllTyVars, but only splits ForAllTys with -- Required type variable binders. All split tyvars are annotated -- with (). tcSplitForAllReqTVBinders :: Type -> ([TcReqTVBinder], Type) -- | Like tcSplitForAllTyVars, but only splits ForAllTys with -- Invisible type variable binders. tcSplitForAllInvisTyVars :: Type -> ([TyVar], Type) -- | Like tcSplitForAllTyVars, but only splits ForAllTys with -- Invisible type variable binders. All split tyvars are annotated -- with their Specificity. tcSplitForAllInvisTVBinders :: Type -> ([TcInvisTVBinder], Type) tcSplitDFunTy :: Type -> ([TyVar], [Type], Class, [Type]) tcSplitDFunHead :: Type -> (Class, [Type]) tcSplitAppTys :: Type -> (Type, [Type]) tcSplitAppTy_maybe :: Type -> Maybe (Type, Type) tcSplitAppTy :: Type -> (Type, Type) -- | Returns the number of arguments in the given type, without looking -- through synonyms. This is used only for error reporting. We don't look -- through synonyms because of #11313. tcRepGetNumAppTys :: Type -> Arity tcIsTyVarTy :: Type -> Bool tcIsTcTyVar :: TcTyVar -> Bool -- | Is this a ForAllTy with a named binder? tcIsForAllTy :: Type -> Bool tcGetTyVar_maybe :: Type -> Maybe TyVar tcGetTyVar :: String -> Type -> TyVar -- | If the type is a tyvar, possibly under a cast, returns it, along with -- the coercion. Thus, the co is :: kind tv ~N kind type tcGetCastedTyVar_maybe :: Type -> Maybe (TyVar, CoercionN) -- | Strips off n *visible* arguments and returns the resulting type tcFunResultTyN :: HasDebugCallStack => Arity -> Type -> Type tcFunResultTy :: Type -> Type tcFunArgTy :: Type -> Scaled Type -- | Like tcEqType, but returns True if the visible part of -- the types are equal, even if they are really unequal (in the invisible -- bits) tcEqTypeVis :: TcType -> TcType -> Bool -- | Just like tcEqType, but will return True for types of different -- kinds as long as their non-coercion structure is identical. tcEqTypeNoKindCheck :: TcType -> TcType -> Bool -- | tcEqType implements typechecker equality, as described in Note -- [Typechecker equality vs definitional equality]. tcEqType :: HasDebugCallStack => TcType -> TcType -> Bool -- | Check whether two TyConApps are the same; if the number of arguments -- are different, just checks the common prefix of arguments. tcEqTyConApps :: TyCon -> [Type] -> TyCon -> [Type] -> Bool tcEqKind :: HasDebugCallStack => TcKind -> TcKind -> Bool -- | Like SynType but accepts a regular TcType synKnownType :: TcType -> SyntaxOpType superSkolemTv :: TcTyVarDetails strictlyDeeperThan :: TcLevel -> TcLevel -> Bool sizeTypes :: [Type] -> TypeSize sizeType :: Type -> TypeSize setMetaTyVarTcLevel :: TcTyVar -> TcLevel -> TcTyVar sameDepthAs :: TcLevel -> TcLevel -> Bool pushTcLevel :: TcLevel -> TcLevel promoteSkolemsX :: TcLevel -> TCvSubst -> [TcTyVar] -> (TCvSubst, [TcTyVar]) -- | Change the TcLevel in a skolem, extending a substitution promoteSkolemX :: TcLevel -> TCvSubst -> TcTyVar -> (TCvSubst, TcTyVar) promoteSkolem :: TcLevel -> TcTyVar -> TcTyVar -- | Like pickyEqTypeVis, but returns a Bool for convenience pickyEqType :: TcType -> TcType -> Bool -- | When inferring types, should we quantify over a given predicate? -- Generally true of classes; generally false of equality constraints. -- Equality constraints that mention quantified type variables and -- implicit variables complicate the story. See Notes [Inheriting -- implicit parameters] and [Quantifying over equality constraints] pickQuantifiablePreds :: TyVarSet -> TcThetaType -> TcThetaType pickCapturedPreds :: TyVarSet -> TcThetaType -> TcThetaType mkTyVarNamePairs :: [TyVar] -> [(Name, TyVar)] mkTcCastTy :: Type -> Coercion -> Type mkTcAppTys :: Type -> [Type] -> Type mkTcAppTy :: Type -> Type -> Type -- | Like mkFunTys but for SyntaxOpType mkSynFunTys :: [SyntaxOpType] -> ExpType -> SyntaxOpType -- | Make a sigma ty where all type variables are "specified". That is, -- they can be used with visible type application mkSpecSigmaTy :: [TyVar] -> [PredType] -> Type -> Type mkSigmaTy :: [TyCoVarBinder] -> [PredType] -> Type -> Type mkPhiTy :: [PredType] -> Type -> Type mkMinimalBySCs :: (a -> PredType) -> [a] -> [a] -- | Make a sigma ty where all type variables are Inferred. That is, -- they cannot be used with visible type application. mkInfSigmaTy :: [TyCoVar] -> [PredType] -> Type -> Type -- | Make an ExpType suitable for checking. mkCheckExpType :: TcType -> ExpType metaTyVarTcLevel_maybe :: TcTyVar -> Maybe TcLevel metaTyVarTcLevel :: TcTyVar -> TcLevel metaTyVarRef :: TyVar -> IORef MetaDetails metaTyVarInfo :: TcTyVar -> MetaInfo maxTcLevel :: TcLevel -> TcLevel -> TcLevel isWordTy :: Type -> Bool isUnitTy :: Type -> Bool isTyVarTyVar :: Var -> Bool isTyVarClassPred :: PredType -> Bool -- | Check that a type does not contain any type family applications. isTyFamFree :: Type -> Bool isTouchableMetaTyVar :: TcLevel -> TcTyVar -> Bool isTopTcLevel :: TcLevel -> Bool -- | Is a type String? isStringTy :: Type -> Bool isSkolemTyVar :: TcTyVar -> Bool isSigmaTy :: TcType -> Bool isRuntimeUnkSkol :: TyVar -> Bool isRigidTy :: TcType -> Bool isRhoTy :: TcType -> Bool -- | Like isRhoTy, but also says True for Infer types isRhoExpTy :: ExpType -> Bool isPromotableMetaTyVar :: TcTyVar -> Bool isOverloadedTy :: Type -> Bool isOverlappableTyVar :: TcTyVar -> Bool -- | If the tycon is applied to the types, is the next argument visible? isNextTyConArgVisible :: TyCon -> [Type] -> Bool -- | Should this type be applied to a visible argument? isNextArgVisible :: TcType -> Bool isNaturalTy :: Type -> Bool isMetaTyVarTy :: TcType -> Bool isIntegerTy :: Type -> Bool isIntTy :: Type -> Bool isIndirect :: MetaDetails -> Bool isImprovementPred :: PredType -> Bool isImmutableTyVar :: TyVar -> Bool isFunPtrTy :: Type -> Bool -- | Does a type represent a floating-point number? isFloatingTy :: Type -> Bool isFloatTy :: Type -> Bool isFlexi :: MetaDetails -> Bool isFFITy :: Type -> Bool isFFIPrimResultTy :: DynFlags -> Type -> Validity isFFIPrimArgumentTy :: DynFlags -> Type -> Validity isFFILabelTy :: Type -> Validity isFFIImportResultTy :: DynFlags -> Type -> Validity isFFIExternalTy :: Type -> Validity isFFIExportResultTy :: Type -> Validity isFFIDynTy :: Type -> Type -> Validity isFFIArgumentTy :: DynFlags -> Safety -> Type -> Validity isDoubleTy :: Type -> Bool isCycleBreakerTyVar :: TcTyVar -> Bool isCharTy :: Type -> Bool -- | Is a type a CallStack? isCallStackTy :: Type -> Bool -- | Is a PredType a CallStack implicit parameter? -- -- If so, return the name of the parameter. isCallStackPred :: Class -> [Type] -> Maybe FastString isBoolTy :: Type -> Bool isAmbiguousTyVar :: TcTyVar -> Bool immSuperClasses :: Class -> [Type] -> [PredType] hasTyVarHead :: Type -> Bool getDFunTyKey :: Type -> OccName findDupTyVarTvs :: [(Name, TcTyVar)] -> [(Name, Name)] exactTyCoVarsOfTypes :: [Type] -> TyCoVarSet exactTyCoVarsOfType :: Type -> TyCoVarSet evVarPred :: EvVar -> PredType deeperThanOrSame :: TcLevel -> TcLevel -> Bool deNoteType :: Type -> Type checkValidClsArgs :: Bool -> Class -> [KindOrType] -> Bool boxEqPred :: EqRel -> Type -> Type -> Maybe (Class, [Type]) anyRewritableTyVar :: Bool -> EqRel -> (EqRel -> TcTyVar -> Bool) -> TcType -> Bool anyRewritableTyFamApp :: EqRel -> (EqRel -> TyCon -> [TcType] -> Bool) -> TcType -> Bool anyRewritableCanEqLHS :: EqRel -> (EqRel -> TcTyVar -> Bool) -> (EqRel -> TyCon -> [TcType] -> Bool) -> TcType -> Bool orphNamesOfTypes :: [Type] -> NameSet orphNamesOfType :: Type -> NameSet orphNamesOfCoCon :: forall (br :: BranchFlag). CoAxiom br -> NameSet orphNamesOfCo :: Coercion -> NameSet lookupOrigNameCache :: OrigNameCache -> Module -> OccName -> Maybe Name extendNameCache :: OrigNameCache -> Module -> OccName -> Name -> OrigNameCache wordTyConName :: Name wordTyCon :: TyCon wordTy :: Type wordDataCon :: DataCon word8TyCon :: TyCon word8Ty :: Type word8DataCon :: DataCon wiredInTyCons :: [TyCon] unrestrictedFunTyConName :: Name unliftedTypeKindTyConName :: Name unliftedRepTyConName :: Name unliftedDataConTyCon :: TyCon unitTyConKey :: Unique unitTyCon :: TyCon unitDataConId :: Id unitDataCon :: DataCon unboxedUnitTyCon :: TyCon unboxedUnitTy :: Type unboxedUnitDataCon :: DataCon -- | Specialization of unboxedTupleSumKind for sums unboxedSumKind :: [Type] -> Kind typeToTypeKind :: Kind typeSymbolKindCon :: TyCon tupleDataConName :: Boxity -> Arity -> Name true_RDR :: RdrName trueDataConId :: Id trueDataCon :: DataCon sumRepDataConTyCon :: TyCon stringTyCon_RDR :: RdrName stringTy :: Type soloTyCon :: TyCon promotedTrueDataCon :: TyCon promotedNothingDataCon :: TyCon promotedNilDataCon :: TyCon promotedLTDataCon :: TyCon promotedJustDataCon :: TyCon promotedGTDataCon :: TyCon promotedFalseDataCon :: TyCon promotedEQDataCon :: TyCon promotedConsDataCon :: TyCon pairTyCon :: TyCon orderingTyCon :: TyCon ordLTDataConId :: Id ordLTDataCon :: DataCon ordGTDataConId :: Id ordGTDataCon :: DataCon ordEQDataConId :: Id ordEQDataCon :: DataCon oneDataConName :: Name oneDataCon :: DataCon nothingDataConName :: Name nothingDataCon :: DataCon nonEmptyTyConName :: Name nonEmptyTyCon :: TyCon nonEmptyDataConName :: Name nonEmptyDataCon :: DataCon nilDataConName :: Name nilDataCon :: DataCon naturalTyConName :: Name naturalTyCon :: TyCon naturalNSDataConName :: Name naturalNSDataCon :: DataCon naturalNBDataConName :: Name naturalNBDataCon :: DataCon multiplicityTyConName :: Name mkWiredInTyConName :: BuiltInSyntax -> Module -> FastString -> Unique -> TyCon -> Name mkWiredInIdName :: Module -> FastString -> Unique -> Id -> Name -- | Make a tuple type. The list of types should not include any -- RuntimeRep specifications. Boxed 1-tuples are *not* flattened. See -- Note [One-tuples] and Note [Don't flatten tuples from HsSyn] in -- GHC.Core.Make mkTupleTy1 :: Boxity -> [Type] -> Type -- | Make a tuple type. The list of types should not include any -- RuntimeRep specifications. Boxed 1-tuples are flattened. See Note -- [One-tuples] mkTupleTy :: Boxity -> [Type] -> Type mkTupleStr :: Boxity -> Arity -> String mkSumTy :: [Type] -> Type mkPromotedPairTy :: Kind -> Kind -> Type -> Type -> Type mkPromotedMaybeTy :: Kind -> Maybe Type -> Type mkMaybeTy :: Type -> Kind mkListTy :: Type -> Type maybeTyConName :: Name maybeTyCon :: TyCon manyDataConName :: Name manyDataCon :: DataCon -- | Make a fake, recovery TyCon from an existing one. Used when -- recovering from errors in type declarations makeRecoveryTyCon :: TyCon -> TyCon listTyCon_RDR :: RdrName listTyConName :: Name liftedTypeKindTyConName :: Name liftedRepTyConName :: Name justDataConName :: Name justDataCon :: DataCon isPromotedPairType :: Type -> Maybe (Type, Type) isPromotedMaybeTy :: Type -> Maybe (Maybe Type) isCTupleTyConName :: Name -> Bool -- | Built-in syntax isn't "in scope" so these OccNames map to wired-in -- Names with BuiltInSyntax. However, this should only be necessary while -- resolving names produced by Template Haskell splices since we take -- care to encode built-in syntax names specially in interface files. See -- Note [Symbol table representation of names]. -- -- Moreover, there is no need to include names of things that the user -- can't write (e.g. type representation bindings like $tc(,,,)). isBuiltInOcc_maybe :: OccName -> Maybe Name integerTyConName :: Name integerTyCon :: TyCon integerISDataConName :: Name integerISDataCon :: DataCon integerIPDataConName :: Name integerIPDataCon :: DataCon integerINDataConName :: Name integerINDataCon :: DataCon intTyCon_RDR :: RdrName intTyConName :: Name intTyCon :: TyCon intTy :: Type intDataCon_RDR :: RdrName intDataCon :: DataCon heqTyConName :: Name heqDataCon :: DataCon heqClass :: Class floatTyConName :: Name floatTyCon :: TyCon floatTy :: Type floatDataCon :: DataCon -- | Replaces constraint tuple names with corresponding boxed ones. filterCTuple :: RdrName -> RdrName false_RDR :: RdrName falseDataConId :: Id falseDataCon :: DataCon eqTyCon_RDR :: RdrName eqTyConName :: Name eqTyCon :: TyCon eqDataCon :: DataCon eqClass :: Class doubleTyConName :: Name doubleTyCon :: TyCon doubleTy :: Type doubleDataCon :: DataCon constraintKindTyConName :: Name constraintKindTyCon :: TyCon consDataCon_RDR :: RdrName consDataConName :: Name consDataCon :: DataCon coercibleTyConName :: Name coercibleDataCon :: DataCon coercibleClass :: Class charTyCon_RDR :: RdrName charTyConName :: Name charTyCon :: TyCon charDataCon :: DataCon cTupleTyConNames :: [Name] -- | If the given name is that of a constraint tuple, return its arity. cTupleTyConNameArity_maybe :: Name -> Maybe Arity cTupleTyCon :: Arity -> TyCon cTupleSelId :: ConTag -> Arity -> Id cTupleDataConNames :: [Name] boxingDataCon_maybe :: TyCon -> Maybe DataCon boolTyCon_RDR :: RdrName boolTyConName :: Name boolTyCon :: TyCon boolTy :: Type anyTyCon :: TyCon anyTy :: Type zapStableUnfolding :: Id -> Id zapLamIdInfo :: Id -> Id zapJoinId :: Id -> Id zapIdUsedOnceInfo :: Id -> Id zapIdUsageInfo :: Id -> Id zapIdUsageEnvInfo :: Id -> Id zapIdTailCallInfo :: Id -> Id zapIdStrictness :: Id -> Id zapIdOccInfo :: Id -> Id zapIdDemandInfo :: Id -> Id zapFragileIdInfo :: Id -> Id updOneShotInfo :: Id -> OneShotInfo -> Id typeOneShot :: Type -> OneShotInfo transferPolyIdInfo :: Id -> [Var] -> Id -> Id -- | Should we apply the state hack to values of this Type? stateHackOneShot :: OneShotInfo setOneShotLambda :: Id -> Id setInlinePragma :: Id -> InlinePragma -> Id infixl 1 `setInlinePragma` setInlineActivation :: Id -> Activation -> Id infixl 1 `setInlineActivation` setIdUnique :: Id -> Unique -> Id setIdUnfolding :: Id -> Unfolding -> Id infixl 1 `setIdUnfolding` -- | Not only does this set the Id Type, it also evaluates -- the type to try and reduce space usage setIdType :: Id -> Type -> Id setIdStrictness :: Id -> StrictSig -> Id infixl 1 `setIdStrictness` setIdSpecialisation :: Id -> RuleInfo -> Id infixl 1 `setIdSpecialisation` setIdOneShotInfo :: Id -> OneShotInfo -> Id infixl 1 `setIdOneShotInfo` setIdOccInfo :: Id -> OccInfo -> Id infixl 1 `setIdOccInfo` setIdNotExported :: Id -> Id setIdName :: Id -> Name -> Id setIdLFInfo :: Id -> LambdaFormInfo -> Id setIdInfo :: Id -> IdInfo -> Id setIdExported :: Id -> Id setIdDemandInfo :: Id -> Demand -> Id infixl 1 `setIdDemandInfo` setIdCprInfo :: Id -> CprSig -> Id infixl 1 `setIdCprInfo` setIdCallArity :: Id -> Arity -> Id infixl 1 `setIdCallArity` setIdCafInfo :: Id -> CafInfo -> Id setIdArity :: Id -> Arity -> Id infixl 1 `setIdArity` setCaseBndrEvald :: StrictnessMark -> Id -> Id -- | Like scaleIdBy, but skips non-Ids. Useful for scaling a mixed -- list of ids and tyvars. scaleVarBy :: Mult -> Var -> Var scaleIdBy :: Mult -> Id -> Id recordSelectorTyCon_maybe :: Id -> Maybe RecSelParent -- | If the Id is that for a record selector, extract the -- sel_tycon. Panic otherwise. recordSelectorTyCon :: Id -> RecSelParent realIdUnfolding :: Id -> Unfolding modifyInlinePragma :: Id -> (InlinePragma -> InlinePragma) -> Id modifyIdInfo :: HasDebugCallStack => (IdInfo -> IdInfo) -> Id -> Id -- | Workers get local names. CoreTidy will externalise these if -- necessary mkWorkerId :: Unique -> Id -> Type -> Id -- | Make a global Id with no global information but some generic -- IdInfo mkVanillaGlobalWithInfo :: Name -> Type -> IdInfo -> Id -- | Make a global Id without any extra information at all mkVanillaGlobal :: Name -> Type -> Id -- | Like mkUserLocal, but checks if we have a coercion type mkUserLocalOrCoVar :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id -- | Create a user local Id. These are local Ids (see -- GHC.Types.Var#globalvslocal) with a name and location that the -- user might recognize mkUserLocal :: OccName -> Unique -> Mult -> Type -> SrcSpan -> Id -- | Create a template local for a series of type, but start from a -- specified template local mkTemplateLocalsNum :: Int -> [Type] -> [Id] -- | Create a template local for a series of types mkTemplateLocals :: [Type] -> [Id] -- | Create a template local: a family of system local Ids in -- bijection with Ints, typically used in unfoldings mkTemplateLocal :: Int -> Type -> Id mkSysLocalOrCoVarM :: MonadUnique m => FastString -> Mult -> Type -> m Id -- | Like mkSysLocal, but checks to see if we have a covar type mkSysLocalOrCoVar :: FastString -> Unique -> Mult -> Type -> Id mkSysLocalM :: MonadUnique m => FastString -> Mult -> Type -> m Id -- | Create a system local Id. These are local Ids (see -- Var#globalvslocal) that are created by the compiler out of thin -- air mkSysLocal :: FastString -> Unique -> Mult -> Type -> Id mkScaledTemplateLocal :: Int -> Scaled Type -> Id mkLocalIdWithInfo :: HasDebugCallStack => Name -> Mult -> Type -> IdInfo -> Id -- | Like mkLocalId, but checks the type to see if it should make a -- covar mkLocalIdOrCoVar :: Name -> Mult -> Type -> Id -- | For an explanation of global vs. local Ids, see -- GHC.Types.Var#globalvslocal mkLocalId :: HasDebugCallStack => Name -> Mult -> Type -> Id -- | Make a local CoVar mkLocalCoVar :: Name -> Type -> CoVar -- | For an explanation of global vs. local Ids, see -- GHC.Types.Var.Var#globalvslocal mkGlobalId :: IdDetails -> Name -> Type -> IdInfo -> Id mkExportedVanillaId :: Name -> Type -> Id -- | Create a local Id that is marked as exported. This prevents -- things attached to it from being removed as dead code. See Note -- [Exported LocalIds] mkExportedLocalId :: IdDetails -> Name -> Type -> Id maybeModifyIdInfo :: Maybe IdInfo -> Id -> Id localiseId :: Id -> Id lazySetIdInfo :: Id -> IdInfo -> Id -- | This predicate says whether the Id has a strict demand placed -- on it or has a type such that it can always be evaluated strictly (i.e -- an unlifted type, as of GHC 7.6). We need to check separately whether -- the Id has a so-called "strict type" because if the demand for -- the given id hasn't been computed yet but id has a -- strict type, we still want isStrictId id to be True. isStrictId :: Id -> Bool isStateHackType :: Type -> Bool isRecordSelector :: Id -> Bool isProbablyOneShotLambda :: Id -> Bool isPrimOpId_maybe :: Id -> Maybe PrimOp isPrimOpId :: Id -> Bool isPatSynRecordSelector :: Id -> Bool -- | Returns whether the lambda associated with the Id is certainly -- applied at most once This one is the "business end", called -- externally. It works on type variables as well as Ids, returning True -- Its main purpose is to encapsulate the Horrible State Hack See Note -- [The state-transformer hack] in GHC.Core.Opt.Arity isOneShotBndr :: Var -> Bool isNeverLevPolyId :: Id -> Bool isNaughtyRecordSelector :: Id -> Bool isJoinId_maybe :: Var -> Maybe JoinArity isJoinId :: Var -> Bool -- | isImplicitId tells whether an Ids info is implied by -- other declarations, so we don't need to put its signature in an -- interface file, even if it's mentioned in some other interface -- unfolding. isImplicitId :: Id -> Bool isFCallId_maybe :: Id -> Maybe ForeignCall isFCallId :: Id -> Bool -- | Returns true if an application to n args diverges or throws an -- exception See Note [Dead ends] in GHC.Types.Demand. isDeadEndId :: Var -> Bool isDeadBinder :: Id -> Bool isDataConWrapId_maybe :: Id -> Maybe DataCon isDataConWrapId :: Id -> Bool isDataConWorkId_maybe :: Id -> Maybe DataCon isDataConWorkId :: Id -> Bool isDataConRecordSelector :: Id -> Bool isDataConId_maybe :: Id -> Maybe DataCon isDFunId :: Id -> Bool isConLikeId :: Id -> Bool isClassOpId_maybe :: Id -> Maybe Class isClassOpId :: Id -> Bool idUnique :: Id -> Unique idUnfolding :: Id -> Unfolding idType :: Id -> Kind -- | Accesses the Id's strictnessInfo. idStrictness :: Id -> StrictSig -- | Like idOneShotInfo, but taking the Horrible State Hack in to -- account See Note [The state-transformer hack] in -- GHC.Core.Opt.Arity idStateHackOneShotInfo :: Id -> OneShotInfo idSpecialisation :: Id -> RuleInfo idScaledType :: Id -> Scaled Type idRuleMatchInfo :: Id -> RuleMatchInfo idOneShotInfo :: Id -> OneShotInfo idOccInfo :: Id -> OccInfo idMult :: Id -> Mult idLFInfo_maybe :: Id -> Maybe LambdaFormInfo idJoinArity :: JoinId -> JoinArity idIsFrom :: Module -> Id -> Bool idInlinePragma :: Id -> InlinePragma idInlineActivation :: Id -> Activation idHasRules :: Id -> Bool idFunRepArity :: Id -> RepArity idDemandInfo :: Id -> Demand -- | Get from either the worker or the wrapper Id to the -- DataCon. Currently used only in the desugarer. -- -- INVARIANT: idDataCon (dataConWrapId d) = d: remember, -- dataConWrapId can return either the wrapper or the worker idDataCon :: Id -> DataCon idCprInfo :: Id -> CprSig idCoreRules :: Id -> [CoreRule] idCallArity :: Id -> Arity idCafInfo :: Id -> CafInfo infixl 1 `idCafInfo` idArity :: Id -> Arity -- | Returns True of an Id which may not have a binding, -- even though it is defined in this module. hasNoBinding :: Id -> Bool clearOneShotLambda :: Id -> Id asJoinId_maybe :: Id -> Maybe JoinArity -> Id infixl 1 `asJoinId_maybe` asJoinId :: Id -> JoinArity -> JoinId infixl 1 `asJoinId` -- | Syntax Expression -- -- SyntaxExpr is represents the function used in interpreting rebindable -- syntax. In the parser, we have no information to supply; in the -- renamer, we have the name of the function (but see Note [Monad fail : -- Rebindable syntax, overloaded strings] for a wrinkle) and in the -- type-checker we have a more elaborate structure SyntaxExprTc. -- -- In some contexts, rebindable syntax is not implemented, and so we have -- constructors to represent that possibility in both the renamer and -- typechecker instantiations. -- -- E.g. (>>=) is filled in before the renamer by the -- appropriate Name for (>>=), and then -- instantiated by the type checker with its type args etc type family SyntaxExpr p data MatchGroup p body MG :: XMG p body -> XRec p [LMatch p body] -> Origin -> MatchGroup p body [mg_ext] :: MatchGroup p body -> XMG p body [mg_alts] :: MatchGroup p body -> XRec p [LMatch p body] [mg_origin] :: MatchGroup p body -> Origin XMatchGroup :: !XXMatchGroup p body -> MatchGroup p body -- | Located Haskell Expression type LHsExpr p = XRec p HsExpr p -- | Haskell Splice data HsSplice id HsTypedSplice :: XTypedSplice id -> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id HsUntypedSplice :: XUntypedSplice id -> SpliceDecoration -> IdP id -> LHsExpr id -> HsSplice id HsQuasiQuote :: XQuasiQuote id -> IdP id -> IdP id -> SrcSpan -> FastString -> HsSplice id HsSpliced :: XSpliced id -> ThModFinalizers -> HsSplicedThing id -> HsSplice id XSplice :: !XXSplice id -> HsSplice id -- | A Haskell expression. data HsExpr p -- | Variable See Note [Located RdrNames] HsVar :: XVar p -> LIdP p -> HsExpr p -- | Unbound variable; also used for "holes" (_ or _x). Turned from HsVar -- to HsUnboundVar by the renamer, when it finds an out-of-scope variable -- or hole. The (XUnboundVar p) field becomes an HoleExprRef after -- typechecking; this is where the erroring expression will be written -- after solving. See Note [Holes] in GHC.Tc.Types.Constraint. HsUnboundVar :: XUnboundVar p -> OccName -> HsExpr p -- | After typechecker only; must be different HsVar for pretty printing HsConLikeOut :: XConLikeOut p -> ConLike -> HsExpr p -- | Variable pointing to record selector The parser produces HsVars The -- renamer renames record-field selectors to HsRecFld The typechecker -- preserves HsRecFld HsRecFld :: XRecFld p -> AmbiguousFieldOcc p -> HsExpr p -- | Overloaded label (Note [Overloaded labels] in GHC.OverloadedLabels) HsOverLabel :: XOverLabel p -> FastString -> HsExpr p -- | Implicit parameter (not in use after typechecking) HsIPVar :: XIPVar p -> HsIPName -> HsExpr p -- | Overloaded literals HsOverLit :: XOverLitE p -> HsOverLit p -> HsExpr p -- | Simple (non-overloaded) literals HsLit :: XLitE p -> HsLit p -> HsExpr p -- | Lambda abstraction. Currently always a single match -- --
-- T :: forall k. k -> k -- tyConArgFlags T [forall m. m -> m -> m, S, R, Q] ---- -- After substituting, we get -- --
-- T (forall m. m -> m -> m) :: (forall m. m -> m -> m) -> forall n. n -> n -> n ---- -- Thus, the first argument is invisible, S is visible, -- R is invisible again, and Q is visible. tyConArgFlags :: TyCon -> [Type] -> [ArgFlag] -- | Retrieve the tycon heading this type, if there is one. Does not -- look through synonyms. tyConAppTyConPicky_maybe :: Type -> Maybe TyCon tyConAppTyCon :: Type -> TyCon -- | Does a TyCon (that is applied to some number of arguments) need -- to be ascribed with an explicit kind signature to resolve ambiguity if -- rendered as a source-syntax type? (See Note [When does a tycon -- application need an explicit kind signature?] for a full -- explanation of what this function checks for.) tyConAppNeedsKindSig :: Bool -> TyCon -> Int -> Bool -- | The same as snd . splitTyConApp tyConAppArgs_maybe :: Type -> Maybe [Type] tyConAppArgs :: Type -> [Type] tyConAppArgN :: Int -> Type -> Type tyCoBinderVar_maybe :: TyCoBinder -> Maybe TyCoVar tyCoBinderType :: TyCoBinder -> Type tyBinderType :: TyBinder -> Type tcTypeKind :: HasDebugCallStack => Type -> Kind -- | Split a type constructor application into its type constructor and -- applied types. Note that this may fail in the case of a FunTy -- with an argument of unknown kind FunTy (e.g. FunTy (a :: k) -- Int. since the kind of a isn't of the form TYPE -- rep). Consequently, you may need to zonk your type before using -- this function. -- -- This does *not* split types headed with (=>), as that's not a TyCon -- in the type-checker. -- -- If you only need the TyCon, consider using -- tcTyConAppTyCon_maybe. tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type]) tcReturnsConstraintKind :: Kind -> Bool -- | Like tcSplitTyConApp_maybe, but doesn't look through synonyms. -- This assumes the synonyms have already been dealt with. -- -- Moreover, for a FunTy, it only succeeds if the argument types have -- enough info to extract the runtime-rep arguments that the funTyCon -- requires. This will usually be true; but may be temporarily false -- during canonicalization: see Note [Decomposing FunTy] in -- GHC.Tc.Solver.Canonical and Note [The Purely Kinded Type Invariant -- (PKTI)] in GHC.Tc.Gen.HsType, Wrinkle around FunTy tcRepSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) -- | Does the AppTy split as in tcSplitAppTy_maybe, but assumes -- that any coreView stuff is already done. Refuses to look through (c -- => t) tcRepSplitAppTy_maybe :: Type -> Maybe (Type, Type) -- | Is this kind equivalent to TYPE r (for some unknown r)? -- -- This considers Constraint to be distinct from *. tcIsRuntimeTypeKind :: Kind -> Bool -- | Is this kind equivalent to Type? -- -- This considers Constraint to be distinct from Type. -- For a version that treats them as the same type, see -- isLiftedTypeKind. tcIsLiftedTypeKind :: Kind -> Bool tcIsConstraintKind :: Kind -> Bool -- | Is this kind equivalent to TYPE (BoxedRep l) for some l -- :: Levity? -- -- This considers Constraint to be distinct from Type. -- For a version that treats them as the same type, see -- isLiftedTypeKind. tcIsBoxedTypeKind :: Kind -> Bool stripCoercionTy :: Type -> Coercion splitVisVarsOfTypes :: [Type] -> Pair TyCoVarSet -- | Retrieve the free variables in this type, splitting them based on -- whether they are used visibly or invisibly. Invisible ones come first. splitVisVarsOfType :: Type -> Pair TyCoVarSet -- | Attempts to tease a type apart into a type constructor and the -- application of a number of arguments to that constructor. Panics if -- that is not possible. See also splitTyConApp_maybe splitTyConApp :: Type -> (TyCon, [Type]) -- | Split off all TyCoBinders to a type, splitting both proper foralls and -- functions splitPiTys :: Type -> ([TyCoBinder], Type) -- | Attempts to take a forall type apart; works with proper foralls and -- functions splitPiTy_maybe :: Type -> Maybe (TyCoBinder, Type) -- | Takes a forall type apart, or panics splitPiTy :: Type -> (TyCoBinder, Type) -- | Attempts to tease a list type apart and gives the type of the elements -- if successful (looks through type synonyms) splitListTyConApp_maybe :: Type -> Maybe Type -- | Same as splitInvisPiTys, but stop when - you have found -- n TyCoBinders, - or you run out of invisible binders splitInvisPiTysN :: Int -> Type -> ([TyCoBinder], Type) -- | Like splitPiTys, but returns only *invisible* binders, -- including constraints. Stops at the first visible binder. splitInvisPiTys :: Type -> ([TyCoBinder], Type) splitFunTys :: Type -> ([Scaled Type], Type) -- | Attempts to extract the multiplicity, argument and result types from a -- type splitFunTy_maybe :: Type -> Maybe (Mult, Type, Type) -- | Attempts to extract the multiplicity, argument and result types from a -- type, and panics if that is not possible. See also -- splitFunTy_maybe splitFunTy :: Type -> (Mult, Type, Type) -- | Like splitForAllTyCoVar_maybe, but only returns Just if it is a -- tyvar binder. splitForAllTyVar_maybe :: Type -> Maybe (TyCoVar, Type) -- | Take a ForAllTy apart, returning the list of tycovars and the result -- type. This always succeeds, even if it returns only an empty list. -- Note that the result type returned may have free variables that were -- bound by a forall. splitForAllTyCoVars :: Type -> ([TyCoVar], Type) -- | Attempts to take a forall type apart, but only if it's a proper -- forall, with a named binder splitForAllTyCoVar_maybe :: Type -> Maybe (TyCoVar, Type) -- | Like splitPiTys but split off only named binders and -- returns TyCoVarBinders rather than TyCoBinders splitForAllTyCoVarBinders :: Type -> ([TyCoVarBinder], Type) -- | Take a forall type apart, or panics if that is not possible. splitForAllTyCoVar :: Type -> (TyCoVar, Type) -- | Like splitForAllTyCoVars, but only splits ForAllTys with -- Required type variable binders. Furthermore, each returned -- tyvar is annotated with (). splitForAllReqTVBinders :: Type -> ([ReqTVBinder], Type) -- | Like splitForAllTyCoVars, but only splits ForAllTys with -- Invisible type variable binders. Furthermore, each returned -- tyvar is annotated with its Specificity. splitForAllInvisTVBinders :: Type -> ([InvisTVBinder], Type) -- | Like splitForAllTyCoVar_maybe, but only returns Just if it is a -- covar binder. splitForAllCoVar_maybe :: Type -> Maybe (TyCoVar, Type) splitCastTy_maybe :: Type -> Maybe (Type, Coercion) -- | Recursively splits a type as far as is possible, leaving a residual -- type being applied to and the type arguments applied to it. Never -- fails, even if that means returning an empty list of type -- applications. splitAppTys :: Type -> (Type, [Type]) -- | Attempt to take a type application apart, whether it is a function, -- type constructor, or plain type application. Note that type family -- applications are NEVER unsaturated by this! splitAppTy_maybe :: Type -> Maybe (Type, Type) -- | Attempts to take a type application apart, as in -- splitAppTy_maybe, and panics if this is not possible splitAppTy :: Type -> (Type, Type) seqTypes :: [Type] -> () seqType :: Type -> () scaledSet :: Scaled a -> b -> Scaled b -- | Looking past all pi-types, is the end result potentially levity -- polymorphic? Example: True for (forall r (a :: TYPE r). String -> -- a) Example: False for (forall r1 r2 (a :: TYPE r1) (b :: TYPE r2). a -- -> b -> Type) resultIsLevPoly :: Type -> Bool -- | Like splitTyConApp_maybe, but doesn't look through synonyms. -- This assumes the synonyms have already been dealt with. repSplitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) -- | Like splitAppTys, but doesn't look through type synonyms repSplitAppTys :: HasDebugCallStack => Type -> (Type, [Type]) -- | Does the AppTy split as in splitAppTy_maybe, but assumes that -- any Core view stuff is already done repSplitAppTy_maybe :: HasDebugCallStack => Type -> Maybe (Type, Type) -- | Attempts to obtain the type variable underlying a Type, without -- any expansion repGetTyVar_maybe :: Type -> Maybe TyVar -- | Render a type corresponding to a user type error into a SDoc. pprUserTypeErrorTy :: Type -> SDoc pickyIsLiftedTypeKind :: Kind -> Bool -- | (piResultTys f_ty [ty1, .., tyn]) gives the type of (f ty1 .. tyn) -- where f :: f_ty piResultTys is interesting because: 1. -- f_ty may have more for-alls than there are args 2. Less -- obviously, it may have fewer for-alls For case 2. think of: -- piResultTys (forall a.a) [forall b.b, Int] This really can happen, but -- only (I think) in situations involving undefined. For example: -- undefined :: forall a. a Term: undefined (forall b. b->b) -- Int This term should have type (Int -> Int), but notice that -- there are more type args than foralls in undefineds type. piResultTys :: HasDebugCallStack => Type -> [Type] -> Type -- | Given a list of things paired with their visibilities, partition the -- things into (invisible things, visible things). partitionInvisibles :: [(a, ArgFlag)] -> ([a], [a]) occCheckExpand :: [Var] -> Type -> Maybe Type nonDetCmpTypesX :: RnEnv2 -> [Type] -> [Type] -> Ordering nonDetCmpTypes :: [Type] -> [Type] -> Ordering nonDetCmpTypeX :: RnEnv2 -> Type -> Type -> Ordering nonDetCmpType :: Type -> Type -> Ordering -- | Compare two TyCons. NB: This should never see -- Constraint (as recognized by Kind.isConstraintKindCon) which -- is considered a synonym for Type in Core. See Note [Kind -- Constraint and kind Type] in GHC.Core.Type. See Note -- [nonDetCmpType nondeterminism] nonDetCmpTc :: TyCon -> TyCon -> Ordering -- | Unwrap one layer of newtype on a type constructor and its -- arguments, using an eta-reduced version of the newtype if -- possible. This requires tys to have at least newTyConInstArity -- tycon elements. newTyConInstRhs :: TyCon -> [Type] -> Type -- | Like mkForAllTys, but assumes all variables are dependent and visible mkVisForAllTys :: [TyVar] -> Type -> Type -- | Given a list of type-level vars and the free vars of a result kind, -- makes TyCoBinders, preferring anonymous binders if the variable is, in -- fact, not dependent. e.g. mkTyConBindersPreferAnon -- (k:*),(b:k),(c:k) We want (k:*) Named, (b:k) Anon, (c:k) Anon -- -- All non-coercion binders are visible. mkTyConBindersPreferAnon :: [TyVar] -> TyCoVarSet -> [TyConBinder] -- | Like mkForAllTys, but assumes all variables are dependent and -- Inferred, a common case mkTyCoInvForAllTys :: [TyCoVar] -> Type -> Type -- | Make a dependent forall over an Inferred variable mkTyCoInvForAllTy :: TyCoVar -> Type -> Type mkStrLitTy :: FastString -> Type -- | Like mkForAllTys, but assumes all variables are dependent and -- Specified, a common case mkSpecForAllTys :: [TyVar] -> Type -> Type -- | Like mkForAllTy, but assumes the variable is dependent and -- Specified, a common case mkSpecForAllTy :: TyVar -> Type -> Type mkScaled :: Mult -> a -> Scaled a mkNumLitTy :: Integer -> Type -- | Like mkTyCoInvForAllTys, but tvs should be a list of tyvar mkInfForAllTys :: [TyVar] -> Type -> Type -- | Like mkTyCoInvForAllTy, but tv should be a tyvar mkInfForAllTy :: TyVar -> Type -> Type -- | Given a family instance TyCon and its arg types, return the -- corresponding family type. E.g: -- --
-- data family T a -- data instance T (Maybe b) = MkT b ---- -- Where the instance tycon is :RTL, so: -- --
-- mkFamilyTyConApp :RTL Int = T (Maybe Int) --mkFamilyTyConApp :: TyCon -> [Type] -> Type mkCoercionTy :: Coercion -> Type mkCharLitTy :: Char -> Type mkAppTys :: Type -> [Type] -> Type -- | Make an anonymous binder mkAnonBinder :: AnonArgFlag -> Scaled Type -> TyCoBinder -- | Returns: -- --
-- FUN :: forall (m :: Multiplicity) ->
-- forall {rep1 :: RuntimeRep} {rep2 :: RuntimeRep}.
-- TYPE rep1 -> TYPE rep2 -> *
--
--
-- The runtime representations quantification is left inferred. This
-- means they cannot be specified with -XTypeApplications.
--
-- This is a deliberate choice to allow future extensions to the function
-- arrow. To allow visible application a type synonym can be defined:
--
-- -- type Arr :: forall (rep1 :: RuntimeRep) (rep2 :: RuntimeRep). -- TYPE rep1 -> TYPE rep2 -> Type -- type Arr = FUN 'Many --funTyCon :: TyCon -- | A substitution of Types for TyVars and Kinds for -- KindVars type TvSubstEnv = TyVarEnv Type -- | Type & coercion substitution -- -- The following invariants must hold of a TCvSubst: -- --
-- data family T a :: * ---- -- Or an associated data type declaration, within a class declaration: -- --
-- class C a b where -- data T b :: * --DataFamilyTyCon :: TyConRepName -> FamTyConFlav -- | An open type synonym family e.g. type family F x y :: * -> -- * OpenSynFamilyTyCon :: FamTyConFlav -- | A closed type synonym family e.g. type family F x where { F Int = -- Bool } ClosedSynFamilyTyCon :: Maybe (CoAxiom Branched) -> FamTyConFlav -- | A closed type synonym family declared in an hs-boot file with type -- family F a where .. AbstractClosedSynFamilyTyCon :: FamTyConFlav -- | Built-in type family used by the TypeNats solver BuiltInSynFamTyCon :: BuiltInSynFamily -> FamTyConFlav -- | Represents right-hand-sides of TyCons for algebraic types data AlgTyConRhs -- | Says that we know nothing about this data type, except that it's -- represented by a pointer. Used when we export a data type abstractly -- into an .hi file. AbstractTyCon :: AlgTyConRhs -- | Information about those TyCons derived from a data -- declaration. This includes data types with no constructors at all. DataTyCon :: [DataCon] -> Int -> Bool -> AlgTyConRhs -- | The data type constructors; can be empty if the user declares the type -- to have no constructors -- -- INVARIANT: Kept in order of increasing DataCon tag (see the tag -- assignment in mkTyConTagMap) [data_cons] :: AlgTyConRhs -> [DataCon] -- | Cached value: length data_cons [data_cons_size] :: AlgTyConRhs -> Int -- | Cached value: is this an enumeration type? See Note [Enumeration -- types] [is_enum] :: AlgTyConRhs -> Bool TupleTyCon :: DataCon -> TupleSort -> AlgTyConRhs -- | The unique constructor for the newtype. It has no -- existentials [data_con] :: AlgTyConRhs -> DataCon -- | Is this a boxed, unboxed or constraint tuple? [tup_sort] :: AlgTyConRhs -> TupleSort -- | An unboxed sum type. SumTyCon :: [DataCon] -> Int -> AlgTyConRhs -- | The data type constructors; can be empty if the user declares the type -- to have no constructors -- -- INVARIANT: Kept in order of increasing DataCon tag (see the tag -- assignment in mkTyConTagMap) [data_cons] :: AlgTyConRhs -> [DataCon] -- | Cached value: length data_cons [data_cons_size] :: AlgTyConRhs -> Int -- | Information about those TyCons derived from a newtype -- declaration NewTyCon :: DataCon -> Type -> ([TyVar], Type) -> CoAxiom Unbranched -> Bool -> AlgTyConRhs -- | The unique constructor for the newtype. It has no -- existentials [data_con] :: AlgTyConRhs -> DataCon -- | Cached value: the argument type of the constructor, which is just the -- representation type of the TyCon (remember that -- newtypes do not exist at runtime so need a different -- representation type). -- -- The free TyVars of this type are the tyConTyVars from -- the corresponding TyCon [nt_rhs] :: AlgTyConRhs -> Type -- | Same as the nt_rhs, but this time eta-reduced. Hence the list -- of TyVars in this field may be shorter than the declared arity -- of the TyCon. [nt_etad_rhs] :: AlgTyConRhs -> ([TyVar], Type) [nt_co] :: AlgTyConRhs -> CoAxiom Unbranched [nt_lev_poly] :: AlgTyConRhs -> Bool data AlgTyConFlav -- | An ordinary type constructor has no parent. VanillaAlgTyCon :: TyConRepName -> AlgTyConFlav -- | An unboxed type constructor. The TyConRepName is a Maybe since we -- currently don't allow unboxed sums to be Typeable since there are too -- many of them. See #13276. UnboxedAlgTyCon :: Maybe TyConRepName -> AlgTyConFlav -- | Type constructors representing a class dictionary. See Note [ATyCon -- for classes] in GHC.Core.TyCo.Rep ClassTyCon :: Class -> TyConRepName -> AlgTyConFlav -- | Type constructors representing an *instance* of a *data* family. -- Parameters: -- -- 1) The type family in question -- -- 2) Instance types; free variables are the tyConTyVars of the -- current TyCon (not the family one). INVARIANT: the number of -- types matches the arity of the family TyCon -- -- 3) A CoTyCon identifying the representation type with the -- type instance family DataFamInstTyCon :: CoAxiom Unbranched -> TyCon -> [Type] -> AlgTyConFlav -- | Both type classes as well as family instances imply implicit type -- constructors. These implicit type constructors refer to their parent -- structure (ie, the class or family from which they derive) using a -- type of the following form. -- -- Extract those DataCons that we are able to learn about. Note -- that visibility in this sense does not correspond to visibility in the -- context of any particular user program! visibleDataCons :: AlgTyConRhs -> [DataCon] -- | Take a TyCon apart into the TyVars it scopes over, the -- Type it expands into, and (possibly) a coercion from the -- representation type to the newtype. Returns Nothing -- if this is not possible. unwrapNewTyCon_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) unwrapNewTyConEtad_maybe :: TyCon -> Maybe ([TyVar], Type, CoAxiom Unbranched) tyConVisibleTyVars :: TyCon -> [TyVar] tyConTuple_maybe :: TyCon -> Maybe TupleSort -- | Find the "stupid theta" of the TyCon. A "stupid theta" is the -- context to the left of an algebraic type declaration, e.g. Eq -- a in the declaration data Eq a => T a ... tyConStupidTheta :: TyCon -> [PredType] -- | Returns whether or not this TyCon is definite, or a hole that -- may be filled in at some later point. See Note [Skolem abstract data] tyConSkolem :: TyCon -> Bool -- | If the given TyCon has a single data constructor, i.e. -- it is a data type with one alternative, a tuple type or a -- newtype then that constructor is returned. If the -- TyCon has more than one constructor, or represents a primitive -- or function type constructor then Nothing is returned. tyConSingleDataCon_maybe :: TyCon -> Maybe DataCon -- | Like tyConSingleDataCon_maybe, but panics if Nothing. tyConSingleDataCon :: TyCon -> DataCon -- | Like tyConSingleDataCon_maybe, but returns Nothing for -- newtypes. tyConSingleAlgDataCon_maybe :: TyCon -> Maybe DataCon -- | Extract any RuntimeRepInfo from this TyCon tyConRuntimeRepInfo :: TyCon -> RuntimeRepInfo -- | Get the list of roles for the type parameters of a TyCon tyConRoles :: TyCon -> [Role] -- | The name (and defining module) for the Typeable representation (TyCon) -- of a type constructor. -- -- See Note [Grand plan for Typeable] in GHC.Tc.Instance.Typeable. tyConRepModOcc :: Module -> OccName -> (Module, OccName) tyConInvisTVBinders :: [TyConBinder] -> [InvisTVBinder] -- | tyConInjectivityInfo tc returns Injective -- is if tc is an injective tycon (where is states -- for which tyConBinders tc is injective), or -- NotInjective otherwise. tyConInjectivityInfo :: TyCon -> Injectivity -- | Get the enclosing class TyCon (if there is one) for the given -- TyConFlavour tyConFlavourAssoc_maybe :: TyConFlavour -> Maybe TyCon tyConFlavour :: TyCon -> TyConFlavour -- | The labels for the fields of this particular TyCon tyConFieldLabels :: TyCon -> [FieldLabel] -- | Determine the number of value constructors a TyCon has. Panics -- if the TyCon is not algebraic or a tuple tyConFamilySize :: TyCon -> Int -- | Extract type variable naming the result of injective type family tyConFamilyResVar_maybe :: TyCon -> Maybe Name -- | If this TyCon is that of a data family instance, return a -- TyCon which represents a coercion identifying the -- representation type with the type instance family. Otherwise, return -- Nothing tyConFamilyCoercion_maybe :: TyCon -> Maybe (CoAxiom Unbranched) -- | If this TyCon is that of a data family instance, return the -- family in question and the instance types. Otherwise, return -- Nothing tyConFamInst_maybe :: TyCon -> Maybe (TyCon, [Type]) tyConFamInstSig_maybe :: TyCon -> Maybe (TyCon, [Type], CoAxiom Unbranched) -- | Determine the DataCons originating from the given TyCon, -- if the TyCon is the sort that can have any constructors (note: -- this does not include abstract algebraic types) tyConDataCons_maybe :: TyCon -> Maybe [DataCon] -- | As tyConDataCons_maybe, but returns the empty list of -- constructors if no constructors could be found tyConDataCons :: TyCon -> [DataCon] -- | If this TyCon is that for a class instance, return the class it -- is for. Otherwise returns Nothing tyConClass_maybe :: TyCon -> Maybe Class tyConCType_maybe :: TyCon -> Maybe CType tyConBndrVisArgFlag :: TyConBndrVis -> ArgFlag tyConBinderArgFlag :: TyConBinder -> ArgFlag -- | Get the enclosing class TyCon (if there is one) for the given TyCon. tyConAssoc_maybe :: TyCon -> Maybe TyCon -- | Returns Just dcs if the given TyCon is a data -- type, a tuple type or a sum type with data constructors dcs. If the -- TyCon has more than one constructor, or represents a primitive -- or function type constructor then Nothing is returned. -- -- Like tyConDataCons_maybe, but returns Nothing for -- newtypes. tyConAlgDataCons_maybe :: TyCon -> Maybe [DataCon] -- | Return the associated types of the TyCon, if any tyConATs :: TyCon -> [TyCon] -- | Is this flavour of TyCon an open type family or a data family? tcFlavourIsOpen :: TyConFlavour -> Bool -- | Extract the information pertaining to the right hand side of a type -- synonym (type) declaration. synTyConRhs_maybe :: TyCon -> Maybe Type -- | Extract the TyVars bound by a vanilla type synonym and the -- corresponding (unsubstituted) right hand side. synTyConDefn_maybe :: TyCon -> Maybe ([TyVar], Type) setTcTyConKind :: TyCon -> Kind -> TyCon primRepsCompatible :: Platform -> [PrimRep] -> [PrimRep] -> Bool -- | The size of a PrimRep in bytes. -- -- This applies also when used in a constructor, where we allow packing -- the fields. For instance, in data Foo = Foo Float# Float# the -- two fields will take only 8 bytes, which for 64-bit arch will be equal -- to 1 word. See also mkVirtHeapOffsetsWithPadding for details of how -- data fields are laid out. primRepSizeB :: Platform -> PrimRep -> Int -- | Return if Rep stands for floating type, returns Nothing for vector -- types. primRepIsFloat :: PrimRep -> Maybe Bool primRepCompatible :: Platform -> PrimRep -> PrimRep -> Bool primElemRepSizeB :: PrimElemRep -> Int pprPromotionQuote :: TyCon -> SDoc -- | No scoped type variables (to be used with mkTcTyCon). noTcTyConScopedTyVars :: [(Name, TcTyVar)] -- | Extract the bound type variables and type expansion of a type synonym -- TyCon. Panics if the TyCon is not a synonym newTyConRhs :: TyCon -> ([TyVar], Type) -- | Extract the bound type variables and type expansion of an -- eta-contracted type synonym TyCon. Panics if the TyCon -- is not a synonym newTyConEtadRhs :: TyCon -> ([TyVar], Type) -- | The number of type parameters that need to be passed to a newtype to -- resolve it. May be less than in the definition if it can be -- eta-contracted. newTyConEtadArity :: TyCon -> Int newTyConDataCon_maybe :: TyCon -> Maybe DataCon -- | Extracts the newtype coercion from such a TyCon, which -- can be used to construct something with the newtypes type -- from its representation type (right hand side). If the supplied -- TyCon is not a newtype, returns Nothing newTyConCo_maybe :: TyCon -> Maybe (CoAxiom Unbranched) newTyConCo :: TyCon -> CoAxiom Unbranched -- | True iff we can decompose (T a b c) into ((T a b) c) I.e. is it -- injective and generative w.r.t nominal equality? That is, if (T a b) -- ~N d e f, is it always the case that (T ~N d), (a ~N e) and (b ~N f)? -- Specifically NOT true of synonyms (open and otherwise) -- -- It'd be unusual to call mustBeSaturated on a regular H98 type synonym, -- because you should probably have expanded it first But regardless, -- it's not decomposable mustBeSaturated :: TyCon -> Bool mkTyConTagMap :: TyCon -> NameEnv ConTag mkTyConKind :: [TyConBinder] -> Kind -> Kind mkTupleTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> DataCon -> TupleSort -> AlgTyConFlav -> TyCon -- | Makes a tycon suitable for use during type-checking. It stores a -- variety of details about the definition of the TyCon, but no -- right-hand side. It lives only during the type-checking of a -- mutually-recursive group of tycons; it is then zonked to a proper -- TyCon in zonkTcTyCon. See also Note [Kind checking recursive type and -- class declarations] in GHC.Tc.TyCl. mkTcTyCon :: Name -> [TyConBinder] -> Kind -> [(Name, TcTyVar)] -> Bool -> TyConFlavour -> TyCon -- | Create a type synonym TyCon mkSynonymTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Type -> Bool -> Bool -> Bool -> TyCon mkSumTyCon :: Name -> [TyConBinder] -> Kind -> Arity -> [TyVar] -> [DataCon] -> AlgTyConFlav -> TyCon -- | Make a Required TyConBinder. It chooses between NamedTCB and AnonTCB -- based on whether the tv is mentioned in the dependent set mkRequiredTyConBinder :: TyCoVarSet -> TyVar -> TyConBinder -- | Create a promoted data constructor TyCon Somewhat dodgily, we -- give it the same Name as the data constructor itself; when we -- pretty-print the TyCon we add a quote; see the Outputable TyCon -- instance mkPromotedDataCon :: DataCon -> Name -> TyConRepName -> [TyConTyCoBinder] -> Kind -> [Role] -> RuntimeRepInfo -> TyCon -- | Create an unlifted primitive TyCon, such as Int#. mkPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon mkNamedTyConBinders :: ArgFlag -> [TyVar] -> [TyConBinder] mkNamedTyConBinder :: ArgFlag -> TyVar -> TyConBinder -- | Create a lifted primitive TyCon such as RealWorld mkLiftedPrimTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> TyCon -- | Kind constructors mkKindTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Name -> TyCon -- | Given the name of the function type constructor and it's kind, create -- the corresponding TyCon. It is recommended to use -- funTyCon if you want this functionality mkFunTyCon :: Name -> [TyConBinder] -> Name -> TyCon -- | Create a type family TyCon mkFamilyTyCon :: Name -> [TyConBinder] -> Kind -> Maybe Name -> FamTyConFlav -> Maybe Class -> Injectivity -> TyCon mkDataTyConRhs :: [DataCon] -> AlgTyConRhs -- | Simpler specialization of mkAlgTyCon for classes mkClassTyCon :: Name -> [TyConBinder] -> [Role] -> AlgTyConRhs -> Class -> Name -> TyCon mkAnonTyConBinders :: AnonArgFlag -> [TyVar] -> [TyConBinder] mkAnonTyConBinder :: AnonArgFlag -> TyVar -> TyConBinder -- | This is the making of an algebraic TyCon. mkAlgTyCon :: Name -> [TyConBinder] -> Kind -> [Role] -> Maybe CType -> [PredType] -> AlgTyConRhs -> AlgTyConFlav -> Bool -> TyCon -- | Look up a field label belonging to this TyCon lookupTyConFieldLabel :: FieldLabelString -> TyCon -> Maybe FieldLabel isVoidRep :: PrimRep -> Bool isVisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool -- | Returns True for vanilla AlgTyCons -- that is, those created -- with a data or newtype declaration. isVanillaAlgTyCon :: TyCon -> Bool -- | Is this TyCon unlifted (i.e. cannot contain bottom)? Note that -- this can only be true for primitive and unboxed-tuple TyCons isUnliftedTyCon :: TyCon -> Bool -- | Is this the TyCon for an unboxed sum? isUnboxedSumTyCon :: TyCon -> Bool -- | Is this a TyCon representing a regular H98 type synonym -- (type)? isTypeSynonymTyCon :: TyCon -> Bool -- | Is this a synonym TyCon that can have may have further -- instances appear? isTypeFamilyTyCon :: TyCon -> Bool -- | Check if the tycon actually refers to a proper `data` or `newtype` -- with user defined constructors rather than one from a class or other -- construction. isTyConWithSrcDataCons :: TyCon -> Bool -- | Is this TyCon for an associated type? isTyConAssoc :: TyCon -> Bool -- | Is this a TcTyCon? (That is, one only used during type-checking?) isTcTyCon :: TyCon -> Bool -- | Could this TyCon ever be levity-polymorphic when fully applied? True -- is safe. False means we're sure. Does only a quick check based on the -- TyCon's category. Precondition: The fully-applied TyCon has kind (TYPE -- blah) isTcLevPoly :: TyCon -> Bool isTauTyCon :: TyCon -> Bool -- | Is this the TyCon for a promoted tuple? isPromotedTupleTyCon :: TyCon -> Bool -- | Retrieves the promoted DataCon if this is a PromotedDataCon; isPromotedDataCon_maybe :: TyCon -> Maybe DataCon -- | Is this a PromotedDataCon? isPromotedDataCon :: TyCon -> Bool -- | Does this TyCon represent something that cannot be defined in -- Haskell? isPrimTyCon :: TyCon -> Bool -- | Is this an open type family TyCon? isOpenTypeFamilyTyCon :: TyCon -> Bool -- | Is this a TyCon, synonym or otherwise, that defines a family -- with instances? isOpenFamilyTyCon :: TyCon -> Bool isNoParent :: AlgTyConFlav -> Bool -- | Is this TyCon that for a newtype isNewTyCon :: TyCon -> Bool isNamedTyConBinder :: TyConBinder -> Bool isLiftedTypeKindTyConName :: Name -> Bool isLiftedAlgTyCon :: TyCon -> Bool -- | Is this tycon really meant for use at the kind level? That is, should -- it be permitted without -XDataKinds? isKindTyCon :: TyCon -> Bool isInvisibleTyConBinder :: VarBndr tv TyConBndrVis -> Bool -- | isInjectiveTyCon is true of TyCons for which this -- property holds (where X is the role passed in): If (T a1 b1 c1) ~X (T -- a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2) (where X1, -- X2, and X3, are the roles given by tyConRolesX tc X) See also Note -- [Decomposing equality] in GHC.Tc.Solver.Canonical isInjectiveTyCon :: TyCon -> Role -> Bool -- | Identifies implicit tycons that, in particular, do not go into -- interface files (because they are implicitly reconstructed when the -- interface is read). -- -- Note that: -- --
-- [| or [e| -- [|| or [e|| ---- -- This type indicates whether the e is present or not. data HasE HasE :: HasE NoE :: HasE -- | The anchor for an AnnKeywordId. The Parser inserts the -- EpaSpan variant, giving the exact location of the -- original item in the parsed source. This can be replaced by the -- EpaDelta version, to provide a position for the item -- relative to the end of the previous item in the source. This is useful -- when editing an AST prior to exact printing the changed one. The list -- of comments in the EpaDelta variant captures any -- comments between the prior output and the thing being marked here, -- since we cannot otherwise sort the relative order. data EpaLocation EpaSpan :: !RealSrcSpan -> EpaLocation EpaDelta :: !DeltaPos -> ![LEpaComment] -> EpaLocation data EpaCommentTok -- | something beginning '-- |' EpaDocCommentNext :: String -> EpaCommentTok -- | something beginning '-- ^' EpaDocCommentPrev :: String -> EpaCommentTok -- | something beginning '-- $' EpaDocCommentNamed :: String -> EpaCommentTok -- | a section heading EpaDocSection :: Int -> String -> EpaCommentTok -- | doc options (prune, ignore-exports, etc) EpaDocOptions :: String -> EpaCommentTok -- | comment starting by "--" EpaLineComment :: String -> EpaCommentTok -- | comment in {- -} EpaBlockComment :: String -> EpaCommentTok -- | empty comment, capturing location of EOF EpaEofComment :: EpaCommentTok data EpaComment EpaComment :: EpaCommentTok -> RealSrcSpan -> EpaComment [ac_tok] :: EpaComment -> EpaCommentTok -- | The location of the prior token, used in exact printing. The -- EpaComment appears as an LEpaComment containing its -- location. The difference between the end of the prior token and the -- start of this location is used for the spacing when exact printing the -- comment. [ac_prior_tok] :: EpaComment -> RealSrcSpan -- | When we are parsing we add comments that belong a particular AST -- element, and print them together with the element, interleaving them -- into the output stream. But when editing the AST to move fragments -- around it is useful to be able to first separate the comments into -- those occuring before the AST element and those following it. The -- EpaCommentsBalanced constructor is used to do this. The GHC -- parser will only insert the EpaComments form. data EpAnnComments EpaComments :: ![LEpaComment] -> EpAnnComments [priorComments] :: EpAnnComments -> ![LEpaComment] EpaCommentsBalanced :: ![LEpaComment] -> ![LEpaComment] -> EpAnnComments [priorComments] :: EpAnnComments -> ![LEpaComment] [followingComments] :: EpAnnComments -> ![LEpaComment] type EpAnnCO = EpAnn NoEpAnns -- | The exact print annotations (EPAs) are kept in the HsSyn AST for the -- GhcPs phase. We do not always have EPAs though, only for code that has -- been parsed as they do not exist for generated code. This type -- captures that they may be missing. -- -- A goal of the annotations is that an AST can be edited, including -- moving subtrees from one place to another, duplicating them, and so -- on. This means that each fragment must be self-contained. To this end, -- each annotated fragment keeps track of the anchor position it was -- originally captured at, being simply the start span of the topmost -- element of the ast fragment. This gives us a way to later re-calculate -- all Located items in this layer of the AST, as well as any annotations -- captured. The comments associated with the AST fragment are also -- captured here. -- -- The ann type parameter allows this general structure to be -- specialised to the specific set of locations of original exact print -- annotation elements. So for HsLet we have -- -- type instance XLet GhcPs = EpAnn AnnsLet data AnnsLet = AnnsLet { -- alLet :: EpaLocation, alIn :: EpaLocation } deriving Data -- -- The spacing between the items under the scope of a given EpAnn is -- normally derived from the original Anchor. But if a sub-element -- is not in its original position, the required spacing can be directly -- captured in the anchor_op field of the entry Anchor. -- This allows us to freely move elements around, and stitch together new -- AST fragments out of old ones, and have them still printed out in a -- precise way. data EpAnn ann EpAnn :: !Anchor -> !ann -> !EpAnnComments -> EpAnn ann -- | Base location for the start of the syntactic element holding the -- annotations. [entry] :: EpAnn ann -> !Anchor -- | Annotations added by the Parser [anns] :: EpAnn ann -> !ann -- | Comments enclosed in the SrcSpan of the element this EpAnn is -- attached to [comments] :: EpAnn ann -> !EpAnnComments -- | No Annotation for generated code, e.g. from TH, deriving, etc. EpAnnNotUsed :: EpAnn ann -- | Spacing between output items when exact printing. It captures the -- spacing from the current print position on the page to the position -- required for the thing about to be printed. This is either on the same -- line in which case is is simply the number of spaces to emit, or it is -- some number of lines down, with a given column offset. The exact -- printing algorithm keeps track of the column offset pertaining to the -- current anchor position, so the deltaColumn is the additional -- spaces to add in this case. See -- https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations for -- details. data DeltaPos SameLine :: !Int -> DeltaPos [deltaColumn] :: DeltaPos -> !Int DifferentLine :: !Int -> !Int -> DeltaPos -- | deltaLine should always be > 0 [deltaLine] :: DeltaPos -> !Int [deltaColumn] :: DeltaPos -> !Int -- | Captures the sort order of sub elements. This is needed when the -- sub-elements have been split (as in a HsLocalBind which holds separate -- binds and sigs) or for infix patterns where the order has been -- re-arranged. It is captured explicitly so that after the Delta phase a -- SrcSpan is used purely as an index into the annotations, allowing -- transformations of the AST including the introduction of new Located -- items or re-arranging existing ones. data AnnSortKey NoAnnSortKey :: AnnSortKey AnnSortKey :: [RealSrcSpan] -> AnnSortKey -- | exact print annotation used for capturing the locations of annotations -- in pragmas. data AnnPragma AnnPragma :: AddEpAnn -> AddEpAnn -> [AddEpAnn] -> AnnPragma [apr_open] :: AnnPragma -> AddEpAnn [apr_close] :: AnnPragma -> AddEpAnn [apr_rest] :: AnnPragma -> [AddEpAnn] -- | exact print annotation for an item having surrounding "brackets", such -- as tuples or lists data AnnParen AnnParen :: ParenType -> EpaLocation -> EpaLocation -> AnnParen [ap_adornment] :: AnnParen -> ParenType [ap_open] :: AnnParen -> EpaLocation [ap_close] :: AnnParen -> EpaLocation -- | Annotation for items appearing in a list. They can have one or more -- trailing punctuations items, such as commas or semicolons. data AnnListItem AnnListItem :: [TrailingAnn] -> AnnListItem [lann_trailing] :: AnnListItem -> [TrailingAnn] -- | Annotation for the "container" of a list. This captures surrounding -- items such as braces if present, and introductory keywords such as -- 'where'. data AnnList AnnList :: Maybe Anchor -> Maybe AddEpAnn -> Maybe AddEpAnn -> [AddEpAnn] -> [TrailingAnn] -> AnnList -- | start point of a list having layout [al_anchor] :: AnnList -> Maybe Anchor [al_open] :: AnnList -> Maybe AddEpAnn [al_close] :: AnnList -> Maybe AddEpAnn -- | context, such as 'where' keyword [al_rest] :: AnnList -> [AddEpAnn] -- | items appearing after the list, such as '=>' for a context [al_trailing] :: AnnList -> [TrailingAnn] -- | Exact print annotations exist so that tools can perform source to -- source conversions of Haskell code. They are used to keep track of the -- various syntactic keywords that are not otherwise captured in the AST. -- -- The wiki page describing this feature is -- https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations -- https://gitlab.haskell.org/ghc/ghc/-/wikis/implementing-trees-that-grow/in-tree-api-annotations -- -- Note: in general the names of these are taken from the corresponding -- token, unless otherwise noted See note [exact print annotations] above -- for details of the usage data AnnKeywordId AnnAnyclass :: AnnKeywordId AnnAs :: AnnKeywordId AnnAt :: AnnKeywordId -- | ! AnnBang :: AnnKeywordId -- | '`' AnnBackquote :: AnnKeywordId AnnBy :: AnnKeywordId -- | case or lambda case AnnCase :: AnnKeywordId AnnClass :: AnnKeywordId -- | '#)' or '#-}' etc AnnClose :: AnnKeywordId -- | '|)' AnnCloseB :: AnnKeywordId -- | '|)', unicode variant AnnCloseBU :: AnnKeywordId -- | '}' AnnCloseC :: AnnKeywordId -- | '|]' AnnCloseQ :: AnnKeywordId -- | '|]', unicode variant AnnCloseQU :: AnnKeywordId -- | ')' AnnCloseP :: AnnKeywordId -- | '#)' AnnClosePH :: AnnKeywordId -- | ']' AnnCloseS :: AnnKeywordId AnnColon :: AnnKeywordId -- | as a list separator AnnComma :: AnnKeywordId -- | in a RdrName for a tuple AnnCommaTuple :: AnnKeywordId -- | '=>' AnnDarrow :: AnnKeywordId -- | '=>', unicode variant AnnDarrowU :: AnnKeywordId AnnData :: AnnKeywordId -- | '::' AnnDcolon :: AnnKeywordId -- | '::', unicode variant AnnDcolonU :: AnnKeywordId AnnDefault :: AnnKeywordId AnnDeriving :: AnnKeywordId AnnDo :: AnnKeywordId -- | . AnnDot :: AnnKeywordId -- | '..' AnnDotdot :: AnnKeywordId AnnElse :: AnnKeywordId AnnEqual :: AnnKeywordId AnnExport :: AnnKeywordId AnnFamily :: AnnKeywordId AnnForall :: AnnKeywordId -- | Unicode variant AnnForallU :: AnnKeywordId AnnForeign :: AnnKeywordId -- | for function name in matches where there are multiple equations for -- the function. AnnFunId :: AnnKeywordId AnnGroup :: AnnKeywordId -- | for CType AnnHeader :: AnnKeywordId AnnHiding :: AnnKeywordId AnnIf :: AnnKeywordId AnnImport :: AnnKeywordId AnnIn :: AnnKeywordId -- | 'infix' or 'infixl' or 'infixr' AnnInfix :: AnnKeywordId AnnInstance :: AnnKeywordId AnnLam :: AnnKeywordId -- | '<-' AnnLarrow :: AnnKeywordId -- | '<-', unicode variant AnnLarrowU :: AnnKeywordId AnnLet :: AnnKeywordId -- | The ⊸ unicode arrow AnnLollyU :: AnnKeywordId AnnMdo :: AnnKeywordId -- | - AnnMinus :: AnnKeywordId AnnModule :: AnnKeywordId AnnNewtype :: AnnKeywordId -- | where a name loses its location in the AST, this carries it AnnName :: AnnKeywordId AnnOf :: AnnKeywordId -- | '{-# DEPRECATED' etc. Opening of pragmas where the capitalisation of -- the string can be changed by the user. The actual text used is stored -- in a SourceText on the relevant pragma item. AnnOpen :: AnnKeywordId -- | '(|' AnnOpenB :: AnnKeywordId -- | '(|', unicode variant AnnOpenBU :: AnnKeywordId -- | '{' AnnOpenC :: AnnKeywordId -- | '[e|' or '[e||' AnnOpenE :: AnnKeywordId -- | '[|' AnnOpenEQ :: AnnKeywordId -- | '[|', unicode variant AnnOpenEQU :: AnnKeywordId -- | '(' AnnOpenP :: AnnKeywordId -- | '[' AnnOpenS :: AnnKeywordId -- | '(#' AnnOpenPH :: AnnKeywordId -- | prefix $ -- TemplateHaskell AnnDollar :: AnnKeywordId -- | prefix $$ -- TemplateHaskell AnnDollarDollar :: AnnKeywordId AnnPackageName :: AnnKeywordId AnnPattern :: AnnKeywordId -- | % -- for HsExplicitMult AnnPercent :: AnnKeywordId -- | '%1' -- for HsLinearArrow AnnPercentOne :: AnnKeywordId AnnProc :: AnnKeywordId AnnQualified :: AnnKeywordId -- | -> AnnRarrow :: AnnKeywordId -- | ->, unicode variant AnnRarrowU :: AnnKeywordId AnnRec :: AnnKeywordId AnnRole :: AnnKeywordId AnnSafe :: AnnKeywordId -- | ';' AnnSemi :: AnnKeywordId -- | ''' AnnSimpleQuote :: AnnKeywordId AnnSignature :: AnnKeywordId -- | static AnnStatic :: AnnKeywordId AnnStock :: AnnKeywordId AnnThen :: AnnKeywordId -- | double ''' AnnThTyQuote :: AnnKeywordId -- | ~ AnnTilde :: AnnKeywordId AnnType :: AnnKeywordId -- | () for types AnnUnit :: AnnKeywordId AnnUsing :: AnnKeywordId -- | e.g. INTEGER AnnVal :: AnnKeywordId -- | String value, will need quotes when output AnnValStr :: AnnKeywordId -- | '|' AnnVbar :: AnnKeywordId -- | via AnnVia :: AnnKeywordId AnnWhere :: AnnKeywordId -- | -< Annlarrowtail :: AnnKeywordId -- | -<, unicode variant AnnlarrowtailU :: AnnKeywordId -- | -> Annrarrowtail :: AnnKeywordId -- | ->, unicode variant AnnrarrowtailU :: AnnKeywordId -- | -<< AnnLarrowtail :: AnnKeywordId -- | -<<, unicode variant AnnLarrowtailU :: AnnKeywordId -- | >>- AnnRarrowtail :: AnnKeywordId -- | >>-, unicode variant AnnRarrowtailU :: AnnKeywordId -- | Exact print annotation for the Context data type. data AnnContext AnnContext :: Maybe (IsUnicodeSyntax, EpaLocation) -> [EpaLocation] -> [EpaLocation] -> AnnContext -- | location and encoding of the '=>', if present. [ac_darrow] :: AnnContext -> Maybe (IsUnicodeSyntax, EpaLocation) -- | zero or more opening parentheses. [ac_open] :: AnnContext -> [EpaLocation] -- | zero or more closing parentheses. [ac_close] :: AnnContext -> [EpaLocation] -- | If tools modify the parsed source, the MovedAnchor variant can -- directly provide the spacing for this item relative to the previous -- one when printing. This allows AST fragments with a particular anchor -- to be freely moved, without worrying about recalculating the -- appropriate anchor span. data AnchorOperation UnchangedAnchor :: AnchorOperation MovedAnchor :: DeltaPos -> AnchorOperation -- | An Anchor records the base location for the start of the -- syntactic element holding the annotations, and is used as the point of -- reference for calculating delta positions for contained annotations. -- It is also normally used as the reference point for the spacing of the -- element relative to its container. If it is moved, that relationship -- is tracked in the anchor_op instead. data Anchor Anchor :: RealSrcSpan -> AnchorOperation -> Anchor -- | Base location for the start of the syntactic element holding the -- annotations. [anchor] :: Anchor -> RealSrcSpan [anchor_op] :: Anchor -> AnchorOperation -- | Captures an annotation, storing the AnnKeywordId and -- its location. The parser only ever inserts EpaLocation -- fields with a RealSrcSpan being the original location of the -- annotation in the source file. The EpaLocation can -- also store a delta position if the AST has been modified and needs to -- be pretty printed again. The usual way an AddEpAnn is created -- is using the mj ("make jump") function, and then it can be -- inserted into the appropriate annotation. data AddEpAnn AddEpAnn :: AnnKeywordId -> EpaLocation -> AddEpAnn -- | The annotations need to all come after the anchor. Make sure this is -- the case. widenSpan :: SrcSpan -> [AddEpAnn] -> SrcSpan widenLocatedAn :: SrcSpanAnn' an -> [AddEpAnn] -> SrcSpanAnn' an widenAnchorR :: Anchor -> RealSrcSpan -> Anchor widenAnchor :: Anchor -> [AddEpAnn] -> Anchor -- | Convert a normal annotation into its unicode equivalent one unicodeAnn :: AnnKeywordId -> AnnKeywordId -- | Transfer comments and trailing items from the annotations in the first -- SrcSpanAnnA argument to those in the second. transferAnnsA :: SrcSpanAnnA -> SrcSpanAnnA -> (SrcSpanAnnA, SrcSpanAnnA) spanAsAnchor :: SrcSpan -> Anchor sortLocatedA :: [GenLocated (SrcSpanAnn' a) e] -> [GenLocated (SrcSpanAnn' a) e] setPriorComments :: EpAnnComments -> [LEpaComment] -> EpAnnComments setFollowingComments :: EpAnnComments -> [LEpaComment] -> EpAnnComments -- | Replace any existing comments on a SrcAnn, used for -- manipulating the AST prior to exact printing the changed one. setCommentsSrcAnn :: Monoid ann => SrcAnn ann -> EpAnnComments -> SrcAnn ann -- | Replace any existing comments, used for manipulating the AST prior to -- exact printing the changed one. setCommentsEpAnn :: Monoid a => SrcSpan -> EpAnn a -> EpAnnComments -> EpAnn a -- | Remove the comments, leaving the exact print annotations payload removeCommentsA :: SrcAnn ann -> SrcAnn ann realSrcSpan :: SrcSpan -> RealSrcSpan realSpanAsAnchor :: RealSrcSpan -> Anchor reLocN :: LocatedN a -> Located a reLocL :: LocatedN e -> LocatedA e reLocC :: LocatedN e -> LocatedC e reLocA :: Located e -> LocatedAn ann e reLoc :: LocatedAn a e -> Located e reAnnL :: ann -> EpAnnComments -> Located e -> GenLocated (SrcAnn ann) e reAnnC :: AnnContext -> EpAnnComments -> Located a -> LocatedC a reAnn :: [TrailingAnn] -> EpAnnComments -> Located a -> LocatedA a placeholderRealSpan :: RealSrcSpan -- | Maps the ParenType to the related opening and closing -- AnnKeywordId. Used when actually printing the item. parenTypeKws :: ParenType -> (AnnKeywordId, AnnKeywordId) noSrcSpanA :: SrcAnn ann noLocA :: a -> LocatedAn an a noComments :: EpAnnCO noAnnSrcSpan :: SrcSpan -> SrcAnn ann -- | Short form for EpAnnNotUsed noAnn :: EpAnn a -- | Helper function (temporary) during transition of names Discards any -- annotations na2la :: SrcSpanAnn' a -> SrcAnn ann n2l :: LocatedN a -> LocatedA a mapLocA :: (a -> b) -> GenLocated SrcSpan a -> GenLocated (SrcAnn ann) b la2r :: SrcSpanAnn' a -> RealSrcSpan -- | Helper function (temporary) during transition of names Discards any -- annotations la2na :: SrcSpanAnn' a -> SrcSpanAnnN -- | Helper function (temporary) during transition of names Discards any -- annotations la2la :: LocatedAn ann1 a2 -> LocatedAn ann2 a2 -- | Helper function (temporary) during transition of names Discards any -- annotations l2n :: LocatedAn a1 a2 -> LocatedN a2 l2l :: SrcSpanAnn' a -> SrcAnn ann getLocAnn :: Located a -> SrcSpanAnnA getLocA :: GenLocated (SrcSpanAnn' a) e -> SrcSpan getFollowingComments :: EpAnnComments -> [LEpaComment] getDeltaLine :: DeltaPos -> Int extraToAnnList :: AnnList -> [AddEpAnn] -> AnnList -- | Used in the parser only, extract the SrcSpan from an -- EpaLocation. The parser will never insert a DeltaPos, so -- the partial function is safe. epaLocationRealSrcSpan :: EpaLocation -> RealSrcSpan epaLocationFromSrcAnn :: SrcAnn ann -> EpaLocation epAnnComments :: EpAnn an -> EpAnnComments epAnnAnnsL :: EpAnn a -> [a] epAnnAnns :: EpAnn [AddEpAnn] -> [AddEpAnn] emptyComments :: EpAnnComments -- | Smart constructor for a DeltaPos. It preserves the invariant -- that for the DifferentLine constructor deltaLine is -- always > 0. deltaPos :: Int -> Int -> DeltaPos -- | Remove the exact print annotations payload, leaving only the anchor -- and comments. commentsOnlyA :: Monoid ann => SrcAnn ann -> SrcAnn ann comment :: RealSrcSpan -> EpAnnComments -> EpAnnCO combineSrcSpansA :: Semigroup a => SrcAnn a -> SrcAnn a -> SrcAnn a combineLocsA :: Semigroup a => GenLocated (SrcAnn a) e1 -> GenLocated (SrcAnn a) e2 -> SrcAnn a annParen2AddEpAnn :: EpAnn AnnParen -> [AddEpAnn] -- | Helper function used in the parser to add a comma location to an -- existing annotation. addTrailingCommaToN :: SrcSpan -> EpAnn NameAnn -> EpaLocation -> EpAnn NameAnn -- | Helper function used in the parser to add a TrailingAnn items -- to an existing annotation. addTrailingAnnToL :: SrcSpan -> TrailingAnn -> EpAnnComments -> EpAnn AnnList -> EpAnn AnnList -- | Helper function used in the parser to add a TrailingAnn items -- to an existing annotation. addTrailingAnnToA :: SrcSpan -> TrailingAnn -> EpAnnComments -> EpAnn AnnListItem -> EpAnn AnnListItem -- | Add additional comments to a SrcAnn, used for manipulating the -- AST prior to exact printing the changed one. addCommentsToSrcAnn :: Monoid ann => SrcAnn ann -> EpAnnComments -> SrcAnn ann -- | Add additional comments, used for manipulating the AST prior to exact -- printing the changed one. addCommentsToEpAnn :: Monoid a => SrcSpan -> EpAnn a -> EpAnnComments -> EpAnn a addCLocAA :: GenLocated (SrcSpanAnn' a1) e1 -> GenLocated (SrcSpanAnn' a2) e2 -> e3 -> GenLocated (SrcAnn ann) e3 -- | Combine locations from two Located things and add them to a -- third thing addCLocA :: GenLocated (SrcSpanAnn' a) e1 -> GenLocated SrcSpan e2 -> e3 -> GenLocated (SrcAnn ann) e3 addAnnsA :: SrcSpanAnnA -> [TrailingAnn] -> EpAnnComments -> SrcSpanAnnA addAnns :: EpAnn [AddEpAnn] -> [AddEpAnn] -> EpAnnComments -> EpAnn [AddEpAnn] -- | Name Environment type NameEnv a = UniqFM Name a -- | Deterministic Name Environment -- -- See Note [Deterministic UniqFM] in GHC.Types.Unique.DFM for -- explanation why we need DNameEnv. type DNameEnv a = UniqDFM Name a unitNameEnv :: Name -> a -> NameEnv a plusNameEnv_CD2 :: (Maybe a -> Maybe a -> a) -> NameEnv a -> NameEnv a -> NameEnv a plusNameEnv_CD :: (a -> a -> a) -> NameEnv a -> a -> NameEnv a -> a -> NameEnv a plusNameEnv_C :: (a -> a -> a) -> NameEnv a -> NameEnv a -> NameEnv a plusNameEnv :: NameEnv a -> NameEnv a -> NameEnv a nameEnvElts :: NameEnv a -> [a] mkNameEnvWith :: (a -> Name) -> [a] -> NameEnv a mkNameEnv :: [(Name, a)] -> NameEnv a mapNameEnv :: (elt1 -> elt2) -> NameEnv elt1 -> NameEnv elt2 mapDNameEnv :: (a -> b) -> DNameEnv a -> DNameEnv b lookupNameEnv_NF :: NameEnv a -> Name -> a lookupNameEnv :: NameEnv a -> Name -> Maybe a lookupDNameEnv :: DNameEnv a -> Name -> Maybe a isEmptyNameEnv :: NameEnv a -> Bool filterNameEnv :: (elt -> Bool) -> NameEnv elt -> NameEnv elt filterDNameEnv :: (a -> Bool) -> DNameEnv a -> DNameEnv a extendNameEnv_C :: (a -> a -> a) -> NameEnv a -> Name -> a -> NameEnv a extendNameEnv_Acc :: (a -> b -> b) -> (a -> b) -> NameEnv b -> Name -> a -> NameEnv b extendNameEnvList_C :: (a -> a -> a) -> NameEnv a -> [(Name, a)] -> NameEnv a extendNameEnvList :: NameEnv a -> [(Name, a)] -> NameEnv a extendNameEnv :: NameEnv a -> Name -> a -> NameEnv a extendDNameEnv :: DNameEnv a -> Name -> a -> DNameEnv a emptyNameEnv :: NameEnv a emptyDNameEnv :: DNameEnv a elemNameEnv :: Name -> NameEnv a -> Bool disjointNameEnv :: NameEnv a -> NameEnv a -> Bool depAnal :: (node -> [Name]) -> (node -> [Name]) -> [node] -> [SCC node] delListFromNameEnv :: NameEnv a -> [Name] -> NameEnv a delFromNameEnv :: NameEnv a -> Name -> NameEnv a delFromDNameEnv :: DNameEnv a -> Name -> DNameEnv a anyNameEnv :: (elt -> Bool) -> NameEnv elt -> Bool alterNameEnv :: (Maybe a -> Maybe a) -> NameEnv a -> Name -> NameEnv a alterDNameEnv :: (Maybe a -> Maybe a) -> DNameEnv a -> Name -> DNameEnv a adjustDNameEnv :: (a -> a) -> DNameEnv a -> Name -> DNameEnv a -- | BuiltInSyntax is for things like (:), [] and tuples, -- which have special syntactic forms. They aren't in scope as such. data BuiltInSyntax BuiltInSyntax :: BuiltInSyntax UserSyntax :: BuiltInSyntax wiredInNameTyThing_maybe :: Name -> Maybe TyThing -- | Compare Names lexicographically This only works for Names that -- originate in the source code or have been tidied. stableNameCmp :: Name -> Name -> Ordering setNameLoc :: Name -> SrcSpan -> Name pprPrefixName :: NamedThing a => a -> SDoc -- | Print the string of Name unqualifiedly directly. pprNameUnqualified :: Name -> SDoc pprNameDefnLoc :: Name -> SDoc pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc pprInfixName :: (Outputable a, NamedThing a) => a -> SDoc pprDefinedAt :: Name -> SDoc -- | Get a string representation of a Name that's unique and stable -- across recompilations. Used for deterministic generation of binds for -- derived instances. eg. -- "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal$String" nameStableString :: Name -> String nameSrcSpan :: Name -> SrcSpan nameSrcLoc :: Name -> SrcLoc nameNameSpace :: Name -> NameSpace nameModule_maybe :: Name -> Maybe Module nameModule :: HasDebugCallStack => Name -> Module -- | Returns True if the name is (a) Internal (b) External but from the -- specified module (c) External but from the interactive -- package -- -- The key idea is that False means: the entity is defined in some other -- module you can find the details (type, fixity, instances) in some -- interface file those details will be stored in the EPT or HPT -- -- True means: the entity is defined in this module or earlier in the -- GHCi session you can find details (type, fixity, instances) in the -- TcGblEnv or TcLclEnv -- -- The isInteractiveModule part is because successive interactions of a -- GHCi session each give rise to a fresh module (Ghci1, Ghci2, etc), but -- they all come from the magic interactive package; and all the -- details are kept in the TcLclEnv, TcGblEnv, NOT in the HPT or EPT. See -- Note [The interactive package] in GHC.Runtime.Context nameIsLocalOrFrom :: Module -> Name -> Bool nameIsHomePackageImport :: Module -> Name -> Bool nameIsHomePackage :: Module -> Name -> Bool -- | Returns True if the Name comes from some other package: neither this -- package nor the interactive package. nameIsFromExternalPackage :: HomeUnit -> Name -> Bool -- | Create a name which is actually defined by the compiler itself mkWiredInName :: Module -> OccName -> Unique -> TyThing -> BuiltInSyntax -> Name mkSystemVarName :: Unique -> FastString -> Name mkSystemNameAt :: Unique -> OccName -> SrcSpan -> Name -- | Create a name brought into being by the compiler mkSystemName :: Unique -> OccName -> Name mkSysTvName :: Unique -> FastString -> Name -- | Create a name which is (for now at least) local to the current module -- and hence does not need a Module to disambiguate it from other -- Names mkInternalName :: Unique -> OccName -> SrcSpan -> Name -- | Make a name for a foreign call mkFCallName :: Unique -> String -> Name -- | Create a name which definitely originates in the given module mkExternalName :: Unique -> Module -> OccName -> SrcSpan -> Name mkDerivedInternalName :: (OccName -> OccName) -> Unique -> Name -> Name mkClonedInternalName :: Unique -> Name -> Name -- | Make the Name into an internal name, regardless of what it was -- to begin with localiseName :: Name -> Name isWiredInName :: Name -> Bool isWiredIn :: NamedThing thing => thing -> Bool isVarName :: Name -> Bool isValName :: Name -> Bool isTyVarName :: Name -> Bool isTyConName :: Name -> Bool isSystemName :: Name -> Bool isInternalName :: Name -> Bool isHoleName :: Name -> Bool isExternalName :: Name -> Bool -- | Will the Name come from a dynamically linked package? isDynLinkName :: Platform -> Module -> Name -> Bool isDataConName :: Name -> Bool isBuiltInSyntax :: Name -> Bool getSrcSpan :: NamedThing a => a -> SrcSpan getSrcLoc :: NamedThing a => a -> SrcLoc getOccString :: NamedThing a => a -> String getOccFS :: NamedThing a => a -> FastString type TidyOccEnv = UniqFM FastString Int type OccSet = UniqSet OccName data OccEnv a data NameSpace varName :: NameSpace unitOccSet :: OccName -> OccSet unitOccEnv :: OccName -> a -> OccEnv a unionOccSets :: OccSet -> OccSet -> OccSet unionManyOccSets :: [OccSet] -> OccSet tvName :: NameSpace tidyOccName :: TidyOccEnv -> OccName -> (TidyOccEnv, OccName) tcName :: NameSpace tcClsName :: NameSpace -- | Haskell 98 encourages compilers to suppress warnings about unused -- names in a pattern if they start with _: this implements that -- test startsWithUnderscore :: OccName -> Bool srcDataName :: NameSpace setOccNameSpace :: NameSpace -> OccName -> OccName promoteOccName :: OccName -> Maybe OccName pprOccName :: OccName -> SDoc pprOccEnv :: (a -> SDoc) -> OccEnv a -> SDoc pprNonVarNameSpace :: NameSpace -> SDoc pprNameSpaceBrief :: NameSpace -> SDoc pprNameSpace :: NameSpace -> SDoc plusOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccEnv a -> OccEnv a plusOccEnv :: OccEnv a -> OccEnv a -> OccEnv a -- | Wrap parens around an operator parenSymOcc :: OccName -> SDoc -> SDoc occEnvElts :: OccEnv a -> [a] nameSpacesRelated :: NameSpace -> NameSpace -> Bool mkWorkerOcc :: OccName -> OccName mkVarOcc :: String -> OccName mkTyVarOccFS :: FastString -> OccName mkTyVarOcc :: String -> OccName mkTyConRepOcc :: OccName -> OccName mkTcOccFS :: FastString -> OccName mkTcOcc :: String -> OccName mkTag2ConOcc :: OccName -> OccName mkSuperDictSelOcc :: Int -> OccName -> OccName mkSuperDictAuxOcc :: Int -> OccName -> OccName mkSpecOcc :: OccName -> OccName mkRepEqOcc :: OccName -> OccName mkOccSet :: [OccName] -> OccSet mkOccNameFS :: NameSpace -> FastString -> OccName mkOccName :: NameSpace -> String -> OccName mkOccEnv_C :: (a -> a -> a) -> [(OccName, a)] -> OccEnv a mkOccEnv :: [(OccName, a)] -> OccEnv a mkNewTyCoOcc :: OccName -> OccName mkMethodOcc :: OccName -> OccName mkMaxTagOcc :: OccName -> OccName mkMatcherOcc :: OccName -> OccName mkLocalOcc :: Unique -> OccName -> OccName -- | Derive a name for the representation type constructor of a -- data/newtype instance. mkInstTyTcOcc :: String -> OccSet -> OccName mkInstTyCoOcc :: OccName -> OccName mkIPOcc :: OccName -> OccName mkGenR :: OccName -> OccName mkGen1R :: OccName -> OccName mkForeignExportOcc :: OccName -> OccName mkEqPredCoOcc :: OccName -> OccName mkDictOcc :: OccName -> OccName mkDefaultMethodOcc :: OccName -> OccName mkDataTOcc :: OccName -> OccName mkDataOccFS :: FastString -> OccName mkDataOcc :: String -> OccName mkDataConWrapperOcc :: OccName -> OccName mkDataConWorkerOcc :: OccName -> OccName mkDataCOcc :: OccName -> OccName mkDFunOcc :: String -> Bool -> OccSet -> OccName mkCon2TagOcc :: OccName -> OccName mkClsOccFS :: FastString -> OccName mkClsOcc :: String -> OccName mkClassOpAuxOcc :: OccName -> OccName mkClassDataConOcc :: OccName -> OccName mkBuilderOcc :: OccName -> OccName minusOccSet :: OccSet -> OccSet -> OccSet mapOccEnv :: (a -> b) -> OccEnv a -> OccEnv b lookupOccEnv :: OccEnv a -> OccName -> Maybe a isVarOcc :: OccName -> Bool isVarNameSpace :: NameSpace -> Bool -- | Value OccNamess are those that are either in the -- variable or data constructor namespaces isValOcc :: OccName -> Bool isValNameSpace :: NameSpace -> Bool -- | Is an OccName one of a Typeable TyCon or -- Module binding? This is needed as these bindings are renamed -- differently. See Note [Grand plan for Typeable] in -- GHC.Tc.Instance.Typeable. isTypeableBindOcc :: OccName -> Bool isTvOcc :: OccName -> Bool isTvNameSpace :: NameSpace -> Bool isTcOcc :: OccName -> Bool isTcClsNameSpace :: NameSpace -> Bool -- | Test if the OccName is that for any operator (whether it is a -- data constructor or variable or whatever) isSymOcc :: OccName -> Bool isEmptyOccSet :: OccSet -> Bool -- | Test for definitions internally generated by GHC. This predicate is -- used to suppress printing of internal definitions in some debug prints isDerivedOccName :: OccName -> Bool isDefaultMethodOcc :: OccName -> Bool -- | Test if the OccName is a data constructor that starts with a -- symbol (e.g. :, or []) isDataSymOcc :: OccName -> Bool isDataOcc :: OccName -> Bool isDataConNameSpace :: NameSpace -> Bool intersectOccSet :: OccSet -> OccSet -> OccSet initTidyOccEnv :: [OccName] -> TidyOccEnv foldOccEnv :: (a -> b -> b) -> b -> OccEnv a -> b filterOccSet :: (OccName -> Bool) -> OccSet -> OccSet filterOccEnv :: (elt -> Bool) -> OccEnv elt -> OccEnv elt extendOccSetList :: OccSet -> [OccName] -> OccSet extendOccSet :: OccSet -> OccName -> OccSet extendOccEnv_C :: (a -> a -> a) -> OccEnv a -> OccName -> a -> OccEnv a extendOccEnv_Acc :: (a -> b -> b) -> (a -> b) -> OccEnv b -> OccName -> a -> OccEnv b extendOccEnvList :: OccEnv a -> [(OccName, a)] -> OccEnv a extendOccEnv :: OccEnv a -> OccName -> a -> OccEnv a emptyTidyOccEnv :: TidyOccEnv emptyOccSet :: OccSet emptyOccEnv :: OccEnv a elemOccSet :: OccName -> OccSet -> Bool elemOccEnv :: OccName -> OccEnv a -> Bool demoteOccName :: OccName -> Maybe OccName delTidyOccEnvList :: TidyOccEnv -> [FastString] -> TidyOccEnv delListFromOccEnv :: OccEnv a -> [OccName] -> OccEnv a delFromOccEnv :: OccEnv a -> OccName -> OccEnv a dataName :: NameSpace clsName :: NameSpace avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv alterOccEnv :: (Maybe elt -> Maybe elt) -> OccEnv elt -> OccName -> OccEnv elt type TyVarBinder = VarBndr TyVar ArgFlag -- | Variable Binder -- -- A TyCoVarBinder is the binder of a ForAllTy It's convenient to -- define this synonym here rather its natural home in -- GHC.Core.TyCo.Rep, because it's used in -- GHC.Core.DataCon.hs-boot -- -- A TyVarBinder is a binder with only TyVar type TyCoVarBinder = VarBndr TyCoVar ArgFlag type OutVar = Var type OutId = Id type JoinId = Id type InVar = Var type InId = Id -- | Dictionary Function Identifier type DFunId = Id updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id updateIdTypeAndMult :: (Type -> Type) -> Id -> Id tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ArgFlag] tyVarKind :: TyVar -> Kind setIdMult :: Id -> Mult -> Id -- | Do these denote the same level of visibility? Required -- arguments are visible, others are not. So this function equates -- Specified and Inferred. Used for printing. sameVis :: ArgFlag -> ArgFlag -> Bool -- | Make many named binders Input vars should be type variables mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis] -- | Make a named binder var should be a type variable mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis -- | Make many named binders mkTyCoVarBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis] -- | Make a named binder mkTyCoVarBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis -- | Does this ArgFlag classify an argument that is written in -- Haskell? isVisibleArgFlag :: ArgFlag -> Bool -- | Is this a type-level (i.e., computationally irrelevant, thus erasable) -- variable? Satisfies isTyVar = not . isId. isTyVar :: Var -> Bool isLocalId :: Var -> Bool -- | Does this ArgFlag classify an argument that is not written in -- Haskell? isInvisibleArgFlag :: ArgFlag -> Bool -- | Is this a value-level (i.e., computationally relevant) -- Varentifier? Satisfies isId = not . isTyVar. isId :: Var -> Bool isGlobalId :: Var -> Bool -- | isExportedIdVar means "don't throw this away" isExportedId :: Var -> Bool idInfo :: HasDebugCallStack => Id -> IdInfo idDetails :: Id -> IdDetails -- | If it's a local, make it global globaliseId :: Id -> Id binderVars :: [VarBndr tv argf] -> [tv] binderVar :: VarBndr tv argf -> tv binderType :: VarBndr TyCoVar argf -> Type binderArgFlag :: VarBndr tv argf -> argf wordRepDataConTy :: Type word8RepDataConTy :: Type word8ElemRepDataConTy :: Type word64RepDataConTy :: Type word64ElemRepDataConTy :: Type word32RepDataConTy :: Type word32ElemRepDataConTy :: Type word16RepDataConTy :: Type word16ElemRepDataConTy :: Type vecRepDataConTyCon :: TyCon vecElemTyCon :: TyCon vecCountTyCon :: TyCon vec8DataConTy :: Type vec64DataConTy :: Type vec4DataConTy :: Type vec32DataConTy :: Type vec2DataConTy :: Type vec16DataConTy :: Type unrestrictedFunTyCon :: TyCon -- |
-- type UnliftedType = TYPE ('BoxedRep 'Unlifted)
--
unliftedTypeKindTyCon :: TyCon
unliftedTypeKind :: Kind
-- | -- type UnliftedRep = 'BoxedRep 'Unlifted --unliftedRepTyCon :: TyCon unliftedRepTy :: Type unliftedDataConTy :: Type unitTy :: Type -- | Specialization of unboxedTupleSumKind for tuples unboxedTupleKind :: [Type] -> Kind typeSymbolKind :: Kind tupleTyConName :: TupleSort -> Arity -> Name tupleTyCon :: Boxity -> Arity -> TyCon tupleRepDataConTyCon :: TyCon tupleDataCon :: Boxity -> Arity -> DataCon -- | Type constructor for n-ary unboxed sum. sumTyCon :: Arity -> TyCon -- | Data constructor for i-th alternative of a n-ary unboxed sum. sumDataCon :: ConTag -> Arity -> DataCon runtimeRepTyCon :: TyCon runtimeRepTy :: Type promotedTupleDataCon :: Boxity -> Arity -> TyCon oneDataConTyCon :: TyCon oneDataConTy :: Type naturalTy :: Type multiplicityTyCon :: TyCon multiplicityTy :: Type multMulTyCon :: TyCon -- | Make a *promoted* list. mkPromotedListTy :: Kind -> [Type] -> Type -- | Build the type of a small tuple that holds the specified type of thing -- Flattens 1-tuples. See Note [One-tuples]. mkBoxedTupleTy :: [Type] -> Type manyDataConTyCon :: TyCon manyDataConTy :: Type listTyCon :: TyCon liftedTypeKindTyCon :: TyCon liftedTypeKind :: Kind -- |
-- type LiftedRep = 'BoxedRep 'Lifted --liftedRepTyCon :: TyCon liftedRepTy :: Type liftedDataConTyCon :: TyCon liftedDataConTy :: Type levityTyCon :: TyCon integerTy :: Type intRepDataConTy :: Type int8RepDataConTy :: Type int8ElemRepDataConTy :: Type int64RepDataConTy :: Type int64ElemRepDataConTy :: Type int32RepDataConTy :: Type int32ElemRepDataConTy :: Type int16RepDataConTy :: Type int16ElemRepDataConTy :: Type heqTyCon :: TyCon floatRepDataConTy :: Type floatElemRepDataConTy :: Type doubleRepDataConTy :: Type doubleElemRepDataConTy :: Type constraintKind :: Kind coercibleTyCon :: TyCon charTy :: Type cTupleTyConName :: Arity -> Name cTupleSelIdName :: ConTag -> Arity -> Name cTupleDataConName :: Arity -> Name cTupleDataCon :: Arity -> DataCon boxedRepDataConTyCon :: TyCon anyTypeOfKind :: Kind -> Type addrRepDataConTy :: Type pprType :: Type -> SDoc pprKind :: Kind -> SDoc -- | The same as fst . splitTyConApp tyConAppTyCon_maybe :: Type -> Maybe TyCon -- | Gives the typechecker view of a type. This unwraps synonyms but leaves -- Constraint alone. c.f. coreView, which turns -- Constraint into Type. Returns Nothing if no -- unwrapping happens. See also Note [coreView vs tcView] tcView :: Type -> Maybe Type -- | Given a RuntimeRep, applies TYPE to it. See Note -- [TYPE and RuntimeRep] in GHC.Builtin.Types.Prim. tYPE :: Type -> Type -- | Attempts to tease a type apart into a type constructor and the -- application of a number of arguments to that constructor splitTyConApp_maybe :: HasDebugCallStack => Type -> Maybe (TyCon, [Type]) piResultTy :: HasDebugCallStack => Type -> Type -> Type -- | Given a TyCon and a list of argument types, partition the -- arguments into: -- --
-- f :: (Eq a) => a -> Int
-- g :: (?x :: Int -> Int) => a -> Int
-- h :: (r\l) => {r} => {l::Int | r}
--
--
-- Here the Eq a and ?x :: Int -> Int and
-- rl are all called "predicates"
type PredType = Type
-- | Mult is a type alias for Type.
--
-- Mult must contain Type because multiplicity variables are mere type
-- variables (of kind Multiplicity) in Haskell. So the simplest
-- implementation is to make Mult be Type.
--
-- Multiplicities can be formed with: - One: GHC.Types.One (= oneDataCon)
-- - Many: GHC.Types.Many (= manyDataCon) - Multiplication:
-- GHC.Types.MultMul (= multMulTyCon)
--
-- So that Mult feels a bit more structured, we provide pattern synonyms
-- and smart constructors for these.
type Mult = Type
type MCoercionN = MCoercion
-- | A semantically more meaningful type to represent what may or may not
-- be a useful Coercion.
data MCoercion
MRefl :: MCoercion
MCo :: Coercion -> MCoercion
-- | The key type representing kinds in the compiler.
type Kind = Type
type CoercionN = Coercion
-- | A Coercion is concrete evidence of the equality/convertibility
-- of two types.
data Coercion
Refl :: Type -> Coercion
GRefl :: Role -> Type -> MCoercionN -> Coercion
TyConAppCo :: Role -> TyCon -> [Coercion] -> Coercion
AppCo :: Coercion -> CoercionN -> Coercion
ForAllCo :: TyCoVar -> KindCoercion -> Coercion -> Coercion
FunCo :: Role -> CoercionN -> Coercion -> Coercion -> Coercion
CoVarCo :: CoVar -> Coercion
AxiomInstCo :: CoAxiom Branched -> BranchIndex -> [Coercion] -> Coercion
AxiomRuleCo :: CoAxiomRule -> [Coercion] -> Coercion
UnivCo :: UnivCoProvenance -> Role -> Type -> Type -> Coercion
SymCo :: Coercion -> Coercion
TransCo :: Coercion -> Coercion -> Coercion
NthCo :: Role -> Int -> Coercion -> Coercion
LRCo :: LeftOrRight -> CoercionN -> Coercion
InstCo :: Coercion -> CoercionN -> Coercion
KindCo :: Coercion -> Coercion
SubCo :: CoercionN -> Coercion
-- | See Note [Coercion holes] Only present during typechecking
HoleCo :: CoercionHole -> Coercion
-- | Create a nullary TyConApp. In general you should rather use
-- mkTyConTy. This merely exists to break the import cycle between
-- TyCon and this module.
mkTyConTy_ :: TyCon -> Type
mkFunTyMany :: AnonArgFlag -> Type -> Type -> Type
-- | Like mkTyCoForAllTy, but does not check the occurrence of the
-- binder See Note [Unused coercion variable in ForAllTy]
mkForAllTy :: TyCoVar -> ArgFlag -> Type -> Type
type TyConRepName = Name
-- | TyCons represent type constructors. Type constructors are introduced
-- by things such as:
--
-- 1) Data declarations: data Foo = ... creates the Foo
-- type constructor of kind *
--
-- 2) Type synonyms: type Foo = ... creates the Foo
-- type constructor
--
-- 3) Newtypes: newtype Foo a = MkFoo ... creates the
-- Foo type constructor of kind * -> *
--
-- 4) Class declarations: class Foo where creates the
-- Foo type constructor of kind *
--
-- This data type also encodes a number of primitive, built in type
-- constructors such as those for function and tuple types.
data TyCon
tyConRepName_maybe :: TyCon -> Maybe TyConRepName
-- | Make a Name for the Typeable representation of the
-- given wired-in type
mkPrelTyConRepName :: Name -> TyConRepName
-- | Is this the TyCon for an unboxed tuple?
isUnboxedTupleTyCon :: TyCon -> Bool
-- | Does this TyCon represent a tuple?
--
-- NB: when compiling Data.Tuple, the tycons won't reply
-- True to isTupleTyCon, because they are built as
-- AlgTyCons. However they get spat into the interface file as
-- tuple tycons, so I don't think it matters.
isTupleTyCon :: TyCon -> Bool
isFunTyCon :: TyCon -> Bool
data Bag a
unitBag :: a -> Bag a
unionManyBags :: [Bag a] -> Bag a
unionBags :: Bag a -> Bag a -> Bag a
snocBag :: Bag a -> a -> Bag a
infixl 3 `snocBag`
partitionBagWith :: (a -> Either b c) -> Bag a -> (Bag b, Bag c)
partitionBag :: (a -> Bool) -> Bag a -> (Bag a, Bag a)
nonEmptyToBag :: NonEmpty a -> Bag a
mapMaybeBag :: (a -> Maybe b) -> Bag a -> Bag b
mapBagM_ :: Monad m => (a -> m b) -> Bag a -> m ()
mapBagM :: Monad m => (a -> m b) -> Bag a -> m (Bag b)
mapBag :: (a -> b) -> Bag a -> Bag b
mapAndUnzipBagM :: Monad m => (a -> m (b, c)) -> Bag a -> m (Bag b, Bag c)
mapAccumBagLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> Bag x -> m (acc, Bag y)
mapAccumBagL :: (acc -> x -> (acc, y)) -> acc -> Bag x -> (acc, Bag y)
listToBag :: [a] -> Bag a
lengthBag :: Bag a -> Int
isSingletonBag :: Bag a -> Bool
isEmptyBag :: Bag a -> Bool
foldBag :: (r -> r -> r) -> (a -> r) -> r -> Bag a -> r
flatMapBagPairM :: Monad m => (a -> m (Bag b, Bag c)) -> Bag a -> m (Bag b, Bag c)
flatMapBagM :: Monad m => (a -> m (Bag b)) -> Bag a -> m (Bag b)
filterBagM :: Monad m => (a -> m Bool) -> Bag a -> m (Bag a)
filterBag :: (a -> Bool) -> Bag a -> Bag a
emptyBag :: Bag a
elemBag :: Eq a => a -> Bag a -> Bool
consBag :: a -> Bag a -> Bag a
infixr 3 `consBag`
concatMapBagPair :: (a -> (Bag b, Bag c)) -> Bag a -> (Bag b, Bag c)
concatMapBag :: (a -> Bag b) -> Bag a -> Bag b
concatBag :: Bag (Bag a) -> Bag a
catBagMaybes :: Bag (Maybe a) -> Bag a
bagToList :: Bag a -> [a]
anyBagM :: Monad m => (a -> m Bool) -> Bag a -> m Bool
anyBag :: (a -> Bool) -> Bag a -> Bool
allBag :: (a -> Bool) -> Bag a -> Bool
data TcTyVarDetails
SkolemTv :: TcLevel -> Bool -> TcTyVarDetails
RuntimeUnk :: TcTyVarDetails
MetaTv :: MetaInfo -> IORef MetaDetails -> TcLevel -> TcTyVarDetails
[mtv_info] :: TcTyVarDetails -> MetaInfo
[mtv_ref] :: TcTyVarDetails -> IORef MetaDetails
[mtv_tclvl] :: TcTyVarDetails -> TcLevel
data MetaDetails
Flexi :: MetaDetails
Indirect :: TcType -> MetaDetails
vanillaSkolemTv :: TcTyVarDetails
pprTcTyVarDetails :: TcTyVarDetails -> SDoc
isTyConableTyVar :: TcTyVar -> Bool
isMetaTyVar :: TcTyVar -> Bool
-- | Flag to see whether we're type-checking terms or kind-checking types
data TypeOrKind
TypeLevel :: TypeOrKind
KindLevel :: TypeOrKind
data TupleSort
BoxedTuple :: TupleSort
UnboxedTuple :: TupleSort
ConstraintTuple :: TupleSort
data TopLevelFlag
TopLevel :: TopLevelFlag
NotTopLevel :: TopLevelFlag
data TailCallInfo
AlwaysTailCalled :: JoinArity -> TailCallInfo
NoTailCallInfo :: TailCallInfo
data SwapFlag
NotSwapped :: SwapFlag
IsSwapped :: SwapFlag
data SuccessFlag
Succeeded :: SuccessFlag
Failed :: SuccessFlag
data SpliceExplicitFlag
-- | = $(f x y)
ExplicitSplice :: SpliceExplicitFlag
-- | = f x y, i.e. a naked top level expression
ImplicitSplice :: SpliceExplicitFlag
type RuleName = FastString
-- | Rule Match Information
data RuleMatchInfo
ConLike :: RuleMatchInfo
FunLike :: RuleMatchInfo
-- | Representation Arity
--
-- The number of represented arguments that can be applied to a value
-- before it does "real work". So: fib 100 has representation arity 0 x
-- -> fib x has representation arity 1 (# x, y #) -> fib (x + y)
-- has representation arity 2
type RepArity = Int
-- | Recursivity Flag
data RecFlag
Recursive :: RecFlag
NonRecursive :: RecFlag
-- | Is a TyCon a promoted data constructor or just a normal type
-- constructor?
data PromotionFlag
NotPromoted :: PromotionFlag
IsPromoted :: PromotionFlag
-- | A general-purpose pretty-printing precedence type.
newtype PprPrec
PprPrec :: Int -> PprPrec
-- | Phase Number
type PhaseNum = Int
data OverlapMode
-- | This instance must not overlap another NoOverlap instance.
-- However, it may be overlapped by Overlapping instances, and it
-- may overlap Overlappable instances.
NoOverlap :: SourceText -> OverlapMode
-- | Silently ignore this instance if you find a more specific one that
-- matches the constraint you are trying to resolve
--
-- Example: constraint (Foo [Int]) instance Foo [Int] instance {-#
-- OVERLAPPABLE #-} Foo [a]
--
-- Since the second instance has the Overlappable flag, the first
-- instance will be chosen (otherwise its ambiguous which to choose)
Overlappable :: SourceText -> OverlapMode
-- | Silently ignore any more general instances that may be used to solve
-- the constraint.
--
-- Example: constraint (Foo [Int]) instance {-# OVERLAPPING #-} Foo [Int]
-- instance Foo [a]
--
-- Since the first instance has the Overlapping flag, the second---more
-- general---instance will be ignored (otherwise it is ambiguous which to
-- choose)
Overlapping :: SourceText -> OverlapMode
-- | Equivalent to having both Overlapping and Overlappable
-- flags.
Overlaps :: SourceText -> OverlapMode
-- | Behave like Overlappable and Overlapping, and in addition pick an
-- arbitrary one if there are multiple matching candidates, and don't
-- worry about later instantiation
--
-- Example: constraint (Foo [b]) instance {-# INCOHERENT -} Foo [Int]
-- instance Foo [a] Without the Incoherent flag, we'd complain that
-- instantiating b would change which instance was chosen. See
-- also note [Incoherent instances] in GHC.Core.InstEnv
Incoherent :: SourceText -> OverlapMode
-- | The semantics allowed for overlapping instances for a particular
-- instance. See Note [Safe Haskell isSafeOverlap] (in
-- GHC.Core.InstEnv) for a explanation of the isSafeOverlap
-- field.
--
--
-- class C a where { foo :: a; bar :: a }
--
ExplicitBraces :: LayoutInfo
-- | Virtual braces inserted by the layout algorithm.
--
-- -- class C a where -- foo :: a -- bar :: a --VirtualBraces :: !Int -> LayoutInfo -- | Empty or compiler-generated blocks do not have layout information -- associated with them. NoLayoutInfo :: LayoutInfo -- | We attach SrcSpans to lots of things, so let's have a datatype for it. data GenLocated l e L :: l -> e -> GenLocated l e -- | StringBuffer Source Span data BufSpan BufSpan :: {-# UNPACK #-} !BufPos -> {-# UNPACK #-} !BufPos -> BufSpan [bufSpanStart] :: BufSpan -> {-# UNPACK #-} !BufPos [bufSpanEnd] :: BufSpan -> {-# UNPACK #-} !BufPos -- | 0-based offset identifying the raw location in the -- StringBuffer. -- -- The lexer increments the BufPos every time a character (UTF-8 -- code point) is read from the input buffer. As UTF-8 is a -- variable-length encoding and StringBuffer needs a byte offset -- for indexing, a BufPos cannot be used for indexing. -- -- The parser guarantees that BufPos are monotonic. See #17632. -- This means that syntactic constructs that appear later in the -- StringBuffer are guaranteed to have a higher BufPos. -- Constrast that with SrcLoc, which does *not* make the analogous -- guarantee about higher line/column numbers. -- -- This is due to #line and {-# LINE ... #-} pragmas that can arbitrarily -- modify SrcLoc. Notice how setSrcLoc and -- resetAlrLastLoc in GHC.Parser.Lexer update -- PsLoc, modifying SrcLoc but preserving BufPos. -- -- Monotonicity makes BufPos useful to determine the order in -- which syntactic elements appear in the source. Consider this example -- (haddockA041 in the test suite): -- -- haddockA041.hs {-# LANGUAGE CPP #-} -- | Module header documentation -- module Comments_and_CPP_include where #include "IncludeMe.hs" -- -- IncludeMe.hs: -- | Comment on T data T = MkT -- ^ Comment on MkT -- -- After the C preprocessor runs, the StringBuffer will contain -- a program that looks like this (unimportant lines at the beginning -- removed): -- -- # 1 "haddockA041.hs" {-# LANGUAGE CPP #-} -- | Module header -- documentation module Comments_and_CPP_include where # 1 "IncludeMe.hs" -- 1 -- | Comment on T data T = MkT -- ^ Comment on MkT # 7 -- "haddockA041.hs" 2 -- -- The line pragmas inserted by CPP make the error messages more -- informative. The downside is that we can't use RealSrcLoc to determine -- the ordering of syntactic elements. -- -- With RealSrcLoc, we have the following location information recorded -- in the AST: * The module name is located at haddockA041.hs:3:8-31 * -- The Haddock comment "Comment on T" is located at IncludeMe:1:1-17 * -- The data declaration is located at IncludeMe.hs:2:1-32 -- -- Is the Haddock comment located between the module name and the data -- declaration? This is impossible to tell because the locations are not -- comparable; they even refer to different files. -- -- On the other hand, with BufPos, we have the following location -- information: * The module name is located at 846-870 * The Haddock -- comment "Comment on T" is located at 898-915 * The data declaration is -- located at 916-928 -- -- Aside: if you're wondering why the numbers are so high, try running -- ghc -E haddockA041.hs and see the extra fluff that CPP -- inserts at the start of the file. -- -- For error messages, BufPos is not useful at all. On the other -- hand, this is exactly what we need to determine the order of syntactic -- elements: 870 < 898, therefore the Haddock comment appears *after* -- the module name. 915 < 916, therefore the Haddock comment appears -- *before* the data declaration. -- -- We use BufPos in in GHC.Parser.PostProcess.Haddock to associate -- Haddock comments with parts of the AST using location information -- (#17544). newtype BufPos BufPos :: Int -> BufPos [bufPos] :: BufPos -> Int -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty wiredInSrcSpan :: SrcSpan unhelpfulSpanFS :: UnhelpfulSpanReason -> FastString unRealSrcSpan :: RealLocated a -> a unLoc :: GenLocated l e -> e srcSpanToRealSrcSpan :: SrcSpan -> Maybe RealSrcSpan srcSpanStartLine :: RealSrcSpan -> Int srcSpanStartCol :: RealSrcSpan -> Int -- | Returns the location at the start of the SrcSpan or a "bad" -- SrcSpan if that is unavailable srcSpanStart :: SrcSpan -> SrcLoc -- | Convert a SrcSpan into one that represents only its first character srcSpanFirstCharacter :: SrcSpan -> SrcSpan -- | Obtains the filename for a SrcSpan if it is "good" srcSpanFileName_maybe :: SrcSpan -> Maybe FastString srcSpanEndLine :: RealSrcSpan -> Int srcSpanEndCol :: RealSrcSpan -> Int -- | Returns the location at the end of the SrcSpan or a "bad" -- SrcSpan if that is unavailable srcSpanEnd :: SrcSpan -> SrcLoc -- | Create a SrcSpan corresponding to a single point srcLocSpan :: SrcLoc -> SrcSpan -- | Raises an error when used on a "bad" SrcLoc srcLocLine :: RealSrcLoc -> Int -- | Gives the filename of the SrcLoc srcLocFile :: RealSrcLoc -> FastString -- | Raises an error when used on a "bad" SrcLoc srcLocCol :: RealSrcLoc -> Int -- | Determines whether a span encloses a given line and column index spans :: SrcSpan -> (Int, Int) -> Bool sortRealLocated :: [RealLocated a] -> [RealLocated a] sortLocated :: [Located a] -> [Located a] -- | Strategies for ordering SrcSpans rightmost_smallest :: SrcSpan -> SrcSpan -> Ordering realSrcSpanStart :: RealSrcSpan -> RealSrcLoc realSrcSpanEnd :: RealSrcSpan -> RealSrcLoc realSrcLocSpan :: RealSrcLoc -> RealSrcSpan psSpanStart :: PsSpan -> PsLoc psSpanEnd :: PsSpan -> PsLoc pprUserSpan :: Bool -> SrcSpan -> SDoc pprUserRealSpan :: Bool -> RealSrcSpan -> SDoc pprUnhelpfulSpanReason :: UnhelpfulSpanReason -> SDoc pprLocated :: (Outputable l, Outputable e) => GenLocated l e -> SDoc -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty noSrcSpan :: SrcSpan -- | Built-in "bad" SrcLoc values for particular locations noSrcLoc :: SrcLoc noLoc :: e -> Located e mkSrcSpanPs :: PsSpan -> SrcSpan -- | Create a SrcSpan between two points in a file mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan mkSrcLoc :: FastString -> Int -> Int -> SrcLoc -- | Create a SrcSpan between two points in a file mkRealSrcSpan :: RealSrcLoc -> RealSrcLoc -> RealSrcSpan mkRealSrcLoc :: FastString -> Int -> Int -> RealSrcLoc mkPsSpan :: PsLoc -> PsLoc -> PsSpan -- | Create a "bad" SrcSpan that has not location information mkGeneralSrcSpan :: FastString -> SrcSpan -- | Creates a "bad" SrcLoc that has no detailed information about -- its location mkGeneralSrcLoc :: FastString -> SrcLoc mkGeneralLocated :: String -> e -> Located e mapLoc :: (a -> b) -> GenLocated l a -> GenLocated l b lookupSrcSpan :: SrcSpan -> Map RealSrcSpan a -> Maybe a lookupSrcLoc :: SrcLoc -> Map RealSrcLoc a -> Maybe a liftL :: Monad m => (a -> m b) -> GenLocated l a -> m (GenLocated l b) -- | Strategies for ordering SrcSpans leftmost_smallest :: SrcSpan -> SrcSpan -> Ordering -- | Strategies for ordering SrcSpans leftmost_largest :: SrcSpan -> SrcSpan -> Ordering -- | Indentation level is 1-indexed, so the leftmost column is 1. leftmostColumn :: Int -- | True if the span has a width of zero, as returned for "virtual" -- semicolons in the lexer. For "bad" SrcSpan, it returns False isZeroWidthSpan :: SrcSpan -> Bool -- | Determines whether a span is enclosed by another one isSubspanOf :: SrcSpan -> SrcSpan -> Bool -- | Determines whether a span is enclosed by another one isRealSubspanOf :: RealSrcSpan -> RealSrcSpan -> Bool -- | True if the span is known to straddle only one line. For "bad" -- SrcSpan, it returns False isOneLineSpan :: SrcSpan -> Bool -- | Test if a SrcSpan is "good", i.e. has precise location -- information isGoodSrcSpan :: SrcSpan -> Bool isGeneratedSrcSpan :: SrcSpan -> Bool -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty interactiveSrcSpan :: SrcSpan -- | Built-in "bad" SrcLoc values for particular locations interactiveSrcLoc :: SrcLoc getRealSrcSpan :: RealLocated a -> RealSrcSpan getLoc :: GenLocated l e -> l getBufSpan :: SrcSpan -> Maybe BufSpan getBufPos :: SrcLoc -> Maybe BufPos -- | Built-in "bad" SrcSpans for common sources of location -- uncertainty generatedSrcSpan :: SrcSpan -- | Built-in "bad" SrcLoc values for particular locations generatedSrcLoc :: SrcLoc -- | Tests whether the two located things are equal eqLocated :: Eq a => GenLocated l a -> GenLocated l a -> Bool -- | Tests whether the first span "contains" the other span, meaning that -- it covers at least as much source code. True where spans are equal. containsSpan :: RealSrcSpan -> RealSrcSpan -> Bool -- | Combines two SrcSpan into one that spans at least all the -- characters within both spans. Returns UnhelpfulSpan if the files -- differ. combineSrcSpans :: SrcSpan -> SrcSpan -> SrcSpan -- | Combines two SrcSpan into one that spans at least all the -- characters within both spans. Assumes the "file" part is the same in -- both inputs combineRealSrcSpans :: RealSrcSpan -> RealSrcSpan -> RealSrcSpan combineLocs :: Located a -> Located b -> SrcSpan -- | Tests the ordering of the two located things cmpLocated :: Ord a => GenLocated l a -> GenLocated l a -> Ordering -- | Compare the BufSpan of two located things. -- -- Precondition: both operands have an associated BufSpan. cmpBufSpan :: HasDebugCallStack => Located a -> Located a -> Ordering -- | Move the SrcLoc down by one line if the character is a newline, -- to the next 8-char tabstop if it is a tab, and across by one character -- in any other case advanceSrcLoc :: RealSrcLoc -> Char -> RealSrcLoc advancePsLoc :: PsLoc -> Char -> PsLoc advanceBufPos :: BufPos -> BufPos -- | Combine locations from two Located things and add them to a -- third thing addCLoc :: Located a -> Located b -> c -> Located c -- | A non-deterministic set of FastStrings. See Note [Deterministic -- UniqFM] in GHC.Types.Unique.DFM for explanation why it's not -- deterministic and why it matters. Use DFastStringEnv if the set -- eventually gets converted into a list or folded over in a way where -- the order changes the generated code. type FastStringEnv a = UniqFM FastString a mkFsEnv :: [(FastString, a)] -> FastStringEnv a lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a extendFsEnv :: FastStringEnv a -> FastString -> a -> FastStringEnv a emptyFsEnv :: FastStringEnv a data UniqSet a -- | unsafeUFMToUniqSet converts a UniqFM a into a -- UniqSet a assuming, without checking, that it maps -- each Unique to a value that has that Unique. See Note -- [UniqSet invariant]. unsafeUFMToUniqSet :: UniqFM a a -> UniqSet a unitUniqSet :: Uniquable a => a -> UniqSet a uniqSetMinusUFM :: UniqSet key -> UniqFM key b -> UniqSet key uniqSetMinusUDFM :: UniqSet key -> UniqDFM key b -> UniqSet key uniqSetAny :: (a -> Bool) -> UniqSet a -> Bool uniqSetAll :: (a -> Bool) -> UniqSet a -> Bool unionUniqSets :: UniqSet a -> UniqSet a -> UniqSet a unionManyUniqSets :: [UniqSet a] -> UniqSet a sizeUniqSet :: UniqSet a -> Int restrictUniqSetToUFM :: UniqSet key -> UniqFM key b -> UniqSet key pprUniqSet :: (a -> SDoc) -> UniqSet a -> SDoc partitionUniqSet :: (a -> Bool) -> UniqSet a -> (UniqSet a, UniqSet a) nonDetStrictFoldUniqSet :: (elt -> a -> a) -> a -> UniqSet elt -> a nonDetKeysUniqSet :: UniqSet elt -> [Unique] nonDetEltsUniqSet :: UniqSet elt -> [elt] mkUniqSet :: Uniquable a => [a] -> UniqSet a minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a mapUniqSet :: Uniquable b => (a -> b) -> UniqSet a -> UniqSet b lookupUniqSet_Directly :: UniqSet a -> Unique -> Maybe a -- | What's the point you might ask? We might have changed an object -- without it's key changing. In which case this lookup makes sense. lookupUniqSet :: Uniquable key => UniqSet key -> key -> Maybe key isEmptyUniqSet :: UniqSet a -> Bool intersectUniqSets :: UniqSet a -> UniqSet a -> UniqSet a getUniqSet :: UniqSet a -> UniqFM a a filterUniqSet_Directly :: (Unique -> elt -> Bool) -> UniqSet elt -> UniqSet elt filterUniqSet :: (a -> Bool) -> UniqSet a -> UniqSet a emptyUniqSet :: UniqSet a elementOfUniqSet :: Uniquable a => a -> UniqSet a -> Bool elemUniqSet_Directly :: Unique -> UniqSet a -> Bool disjointUniqSets :: UniqSet a -> UniqSet a -> Bool delOneFromUniqSet_Directly :: UniqSet a -> Unique -> UniqSet a delOneFromUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a delListFromUniqSet_Directly :: UniqSet a -> [Unique] -> UniqSet a delListFromUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a addOneToUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a addListToUniqSet :: Uniquable a => UniqSet a -> [a] -> UniqSet a -- | For a given package, we need to know whether to print it with the -- component id to disambiguate it. type QueryQualifyPackage = Unit -> Bool -- | Given a Name's Module and OccName, decide -- whether and how to qualify it. type QueryQualifyName = Module -> OccName -> QualifyName -- | For a given module, we need to know whether to print it with a package -- name to disambiguate it. type QueryQualifyModule = Module -> Bool data QualifyName NameUnqual :: QualifyName NameQual :: ModuleName -> QualifyName NameNotInScope1 :: QualifyName NameNotInScope2 :: QualifyName -- | When printing code that contains original names, we need to map the -- original names back to something the user understands. This is the -- purpose of the triple of functions that gets passed around when -- rendering SDoc. data PrintUnqualified QueryQualify :: QueryQualifyName -> QueryQualifyModule -> QueryQualifyPackage -> PrintUnqualified [queryQualifyName] :: PrintUnqualified -> QueryQualifyName [queryQualifyModule] :: PrintUnqualified -> QueryQualifyModule [queryQualifyPackage] :: PrintUnqualified -> QueryQualifyPackage -- | Wrapper for types having a Outputable instance when an OutputableP -- instance is required. newtype PDoc a PDoc :: a -> PDoc a -- | Outputable class with an additional environment value -- -- See Note [The OutputableP class] class OutputableP env a pdoc :: OutputableP env a => env -> a -> SDoc -- | When we print a binder, we often want to print its type too. The -- OutputableBndr class encapsulates this idea. class Outputable a => OutputableBndr a pprBndr :: OutputableBndr a => BindingSite -> a -> SDoc pprPrefixOcc :: OutputableBndr a => a -> SDoc pprInfixOcc :: OutputableBndr a => a -> SDoc bndrIsJoin_maybe :: OutputableBndr a => a -> Maybe Int -- | Class designating that some type has an SDoc representation class Outputable a ppr :: Outputable a => a -> SDoc -- | Style of label pretty-printing. -- -- When we produce C sources or headers, we have to take into account -- that C compilers transform C labels when they convert them into -- symbols. For example, they can add prefixes (e.g., "_" on Darwin) or -- suffixes (size for stdcalls on Windows). So we provide two ways to -- pretty-print CLabels: C style or Asm style. data LabelStyle -- | C label style (used by C and LLVM backends) CStyle :: LabelStyle -- | Asm label style (used by NCG backend) AsmStyle :: LabelStyle data Depth AllTheWay :: Depth -- | 0 => stop PartWay :: Int -> Depth -- | Use sdocDefaultDepth field as depth DefaultDepth :: Depth -- | BindingSite is used to tell the thing that prints binder what -- language construct is binding the identifier. This can be used to -- decide how much info to print. Also see Note [Binding-site specific -- printing] in GHC.Core.Ppr data BindingSite -- | The x in (x. e) LambdaBind :: BindingSite -- | The x in case scrut of x { (y,z) -> ... } CaseBind :: BindingSite -- | The y,z in case scrut of x { (y,z) -> ... } CasePatBind :: BindingSite -- | The x in (let x = rhs in e) LetBind :: BindingSite ztext :: FastZString -> SDoc word :: Integer -> SDoc withUserStyle :: PrintUnqualified -> Depth -> SDoc -> SDoc withPprStyle :: PprStyle -> SDoc -> SDoc withErrStyle :: PrintUnqualified -> SDoc -> SDoc -- | Says what to do with -dppr-debug; without, return empty whenPprDebug :: SDoc -> SDoc -- | Concatenate SDoc vertically with dovetailing vcat :: [SDoc] -> SDoc vbar :: SDoc userStyle :: PprStyle -> Bool updSDocContext :: (SDocContext -> SDocContext) -> SDoc -> SDoc unicodeSyntax :: SDoc -> SDoc -> SDoc underscore :: SDoc -- | Converts an integer to a verbal index: -- --
-- speakNth 1 = text "first" -- speakNth 5 = text "fifth" -- speakNth 21 = text "21st" --speakNth :: Int -> SDoc -- | Converts an integer and object description to a statement about the -- multiplicity of those objects: -- --
-- speakNOf 0 (text "melon") = text "no melons" -- speakNOf 1 (text "melon") = text "one melon" -- speakNOf 3 (text "melon") = text "three melons" --speakNOf :: Int -> SDoc -> SDoc -- | Converts an integer to a verbal multiplicity: -- --
-- speakN 0 = text "none" -- speakN 5 = text "five" -- speakN 10 = text "10" --speakN :: Int -> SDoc space :: SDoc showSDocUnsafe :: SDoc -> String showSDocOneLine :: SDocContext -> SDoc -> String showPprUnsafe :: Outputable a => a -> String setStyleColoured :: Bool -> PprStyle -> PprStyle -- | Separate: is either like hsep or like vcat, depending on -- what fits sep :: [SDoc] -> SDoc semi :: SDoc sdocWithContext :: (SDocContext -> SDoc) -> SDoc sdocOption :: (SDocContext -> a) -> (a -> SDoc) -> SDoc runSDoc :: SDoc -> SDocContext -> Doc rparen :: SDoc renderWithContext :: SDocContext -> SDoc -> String reallyAlwaysQualifyNames :: QueryQualifyName reallyAlwaysQualify :: PrintUnqualified rbrack :: SDoc rbrace :: SDoc rational :: Rational -> SDoc quotes :: SDoc -> SDoc quotedListWithOr :: [SDoc] -> SDoc quotedListWithNor :: [SDoc] -> SDoc quote :: SDoc -> SDoc queryQual :: PprStyle -> PrintUnqualified qualPackage :: PprStyle -> QueryQualifyPackage qualName :: PprStyle -> QueryQualifyName qualModule :: PprStyle -> QueryQualifyModule punctuate :: SDoc -> [SDoc] -> [SDoc] ptext :: PtrString -> SDoc -- | Like printSDoc but appends an extra newline. printSDocLn :: SDocContext -> Mode -> Handle -> SDoc -> IO () -- | The analog of printDoc_ for SDoc, which tries to make -- sure the terminal doesn't get screwed up by the ANSI color codes if an -- exception is thrown during pretty-printing. printSDoc :: SDocContext -> Mode -> Handle -> SDoc -> IO () primWordSuffix :: SDoc primWord8Suffix :: SDoc primWord64Suffix :: SDoc primWord32Suffix :: SDoc primWord16Suffix :: SDoc primIntSuffix :: SDoc primInt8Suffix :: SDoc primInt64Suffix :: SDoc primInt32Suffix :: SDoc primInt16Suffix :: SDoc primFloatSuffix :: SDoc primDoubleSuffix :: SDoc primCharSuffix :: SDoc pprWithCommas :: (a -> SDoc) -> [a] -> SDoc pprWithBars :: (a -> SDoc) -> [a] -> SDoc pprSetDepth :: Depth -> SDoc -> SDoc -- | Returns the comma-separated concatenation of the quoted pretty printed -- things. -- --
-- [x,y,z] ==> `x', `y', `z' --pprQuotedList :: Outputable a => [a] -> SDoc pprPrimWord8 :: Integer -> SDoc pprPrimWord64 :: Integer -> SDoc pprPrimWord32 :: Integer -> SDoc pprPrimWord16 :: Integer -> SDoc pprPrimWord :: Integer -> SDoc pprPrimInt8 :: Integer -> SDoc pprPrimInt64 :: Integer -> SDoc pprPrimInt32 :: Integer -> SDoc pprPrimInt16 :: Integer -> SDoc pprPrimInt :: Integer -> SDoc -- | Special combinator for showing unboxed literals. pprPrimChar :: Char -> SDoc pprPrefixVar :: Bool -> SDoc -> SDoc pprInfixVar :: Bool -> SDoc -> SDoc -- | Special combinator for showing string literals. pprHsString :: FastString -> SDoc -- | Special combinator for showing character literals. pprHsChar :: Char -> SDoc -- | Special combinator for showing bytestring literals. pprHsBytes :: ByteString -> SDoc -- | Normalise, escape and render a string representing a path -- -- e.g. "c:\whatever" pprFilePathString :: FilePath -> SDoc pprFastFilePath :: FastString -> SDoc -- | Truncate a list that is longer than the current depth. pprDeeperList :: ([SDoc] -> SDoc) -> [SDoc] -> SDoc pprDeeper :: SDoc -> SDoc pprCode :: LabelStyle -> SDoc -> SDoc ppWhenOption :: (SDocContext -> Bool) -> SDoc -> SDoc ppWhen :: Bool -> SDoc -> SDoc ppUnlessOption :: (SDocContext -> Bool) -> SDoc -> SDoc ppUnless :: Bool -> SDoc -> SDoc -- | Determines the pluralisation suffix appropriate for the length of a -- list: -- --
-- plural [] = char 's' -- plural ["Hello"] = empty -- plural ["Hello", "World"] = char 's' --plural :: [a] -> SDoc parens :: SDoc -> SDoc neverQualifyPackages :: QueryQualifyPackage neverQualifyNames :: QueryQualifyName neverQualifyModules :: QueryQualifyModule neverQualify :: PrintUnqualified -- | Indent SDoc some specified amount nest :: Int -> SDoc -> SDoc mulArrow :: SDoc -> SDoc mkUserStyle :: PrintUnqualified -> Depth -> PprStyle -- | Style for printing error messages mkErrStyle :: PrintUnqualified -> PprStyle mkDumpStyle :: PrintUnqualified -> PprStyle lparen :: SDoc lollipop :: SDoc lbrack :: SDoc lbrace :: SDoc larrowtt :: SDoc larrowt :: SDoc larrow :: SDoc lambda :: SDoc keyword :: SDoc -> SDoc -- | Determines the form of possessive appropriate for the length of a -- list: -- --
-- itsOrTheir [x] = text "its" -- itsOrTheir [x,y] = text "their" -- itsOrTheir [] = text "their" -- probably avoid this --itsOrTheir :: [a] -> SDoc -- | Determines the form of to be appropriate for the length of a list: -- --
-- isOrAre [] = text "are" -- isOrAre ["Hello"] = text "is" -- isOrAre ["Hello", "World"] = text "are" --isOrAre :: [a] -> SDoc isEmpty :: SDocContext -> SDoc -> Bool -- | Returns the separated concatenation of the pretty printed things. interppSP :: Outputable a => [a] -> SDoc interpp'SP' :: (a -> SDoc) -> [a] -> SDoc -- | Returns the comma-separated concatenation of the pretty printed -- things. interpp'SP :: Outputable a => [a] -> SDoc integer :: Integer -> SDoc intWithCommas :: Integral a => a -> SDoc int :: Int -> SDoc -- | Says what to do with and without -dppr-debug ifPprDebug :: SDoc -> SDoc -> SDoc -- | Concatenate SDoc horizontally with a space between each one hsep :: [SDoc] -> SDoc -- | Concatenate SDoc horizontally hcat :: [SDoc] -> SDoc -- | This behaves like hang, but does not indent the second document -- when the header is empty. hangNotEmpty :: SDoc -> Int -> SDoc -> SDoc hang :: SDoc -> Int -> SDoc -> SDoc getPprStyle :: (PprStyle -> SDoc) -> SDoc -- | Indicate if -dppr-debug mode is enabled getPprDebug :: (Bool -> SDoc) -> SDoc ftext :: FastString -> SDoc -- | A paragraph-fill combinator. It's much like sep, only it keeps fitting -- things on one line until it can't fit any more. fsep :: [SDoc] -> SDoc forAllLit :: SDoc float :: Float -> SDoc -- | This behaves like fsep, but it uses <> for -- horizontal conposition rather than <+> fcat :: [SDoc] -> SDoc equals :: SDoc empty :: SDoc dumpStyle :: PprStyle -> Bool doubleQuotes :: SDoc -> SDoc -- | doublePrec p n shows a floating point number n with -- p digits of precision after the decimal point. doublePrec :: Int -> Double -> SDoc double :: Double -> SDoc dot :: SDoc docToSDoc :: Doc -> SDoc -- | Determines the form of to do appropriate for the length of a list: -- --
-- doOrDoes [] = text "do" -- doOrDoes ["Hello"] = text "does" -- doOrDoes ["Hello", "World"] = text "do" --doOrDoes :: [a] -> SDoc defaultUserStyle :: PprStyle -- | Default pretty-printing options defaultSDocContext :: SDocContext -- | Default style for error messages, when we don't know PrintUnqualified -- It's a bit of a hack because it doesn't take into account what's in -- scope Only used for desugarer warnings, and typechecker errors in -- interface sigs defaultErrStyle :: PprStyle defaultDumpStyle :: PprStyle dcolon :: SDoc darrow :: SDoc cparen :: Bool -> SDoc -> SDoc comma :: SDoc -- | Apply the given colour/style for the argument. -- -- Only takes effect if colours are enabled. coloured :: PprColour -> SDoc -> SDoc colon :: SDoc codeStyle :: PprStyle -> Bool cmdlineParserStyle :: PprStyle char :: Char -> SDoc -- | Catenate: is either like hcat or like vcat, depending on -- what fits cat :: [SDoc] -> SDoc bullet :: SDoc -- | An efficient variant of printSDoc specialized for -- LeftMode that outputs to a BufHandle. bufLeftRenderSDoc :: SDocContext -> BufHandle -> SDoc -> IO () brackets :: SDoc -> SDoc braces :: SDoc -> SDoc blankLine :: SDoc asmStyle :: PprStyle -> Bool arrowtt :: SDoc arrowt :: SDoc arrow :: SDoc angleBrackets :: SDoc -> SDoc alwaysQualifyPackages :: QueryQualifyPackage -- | NB: This won't ever show package IDs alwaysQualifyNames :: QueryQualifyName alwaysQualifyModules :: QueryQualifyModule alwaysQualify :: PrintUnqualified -- | Join two SDoc together horizontally without a gap (<>) :: SDoc -> SDoc -> SDoc -- | Join two SDoc together horizontally with a gap between them (<+>) :: SDoc -> SDoc -> SDoc -- | Join two SDoc together vertically ($+$) :: SDoc -> SDoc -> SDoc -- | Join two SDoc together vertically; if there is no vertical -- overlap it "dovetails" the two onto one line ($$) :: SDoc -> SDoc -> SDoc -- | Occurrence Name -- -- In this context that means: "classified (i.e. as a type name, value -- name, etc) but not qualified and not yet resolved" data OccName -- | Other names in the compiler add additional information to an OccName. -- This class provides a consistent way to access the underlying OccName. class HasOccName name occName :: HasOccName name => name -> OccName occNameString :: OccName -> String mkVarOccFS :: FastString -> OccName mkRecFldSelOcc :: String -> OccName -- | A PtrString is a pointer to some array of Latin-1 encoded -- chars. data PtrString PtrString :: !Ptr Word8 -> !Int -> PtrString -- | Non-deterministic FastString -- -- This is a simple FastString wrapper with an Ord instance using -- uniqCompareFS (i.e. which compares FastStrings on their -- Uniques). Hence it is not deterministic from one run to the other. newtype NonDetFastString NonDetFastString :: FastString -> NonDetFastString -- | Lexical FastString -- -- This is a simple FastString wrapper with an Ord instance using -- lexicalCompareFS (i.e. which compares FastStrings on their -- String representation). Hence it is deterministic from one run to the -- other. newtype LexicalFastString LexicalFastString :: FastString -> LexicalFastString data FastZString -- | A FastString is a UTF-8 encoded string together with a unique -- ID. All FastStrings are stored in a global hashtable to support -- fast O(1) comparison. -- -- It is also associated with a lazy reference to the Z-encoding of this -- string which is used by the compiler internally. data FastString FastString :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !ShortByteString -> FastZString -> FastString [uniq] :: FastString -> {-# UNPACK #-} !Int [n_chars] :: FastString -> {-# UNPACK #-} !Int [fs_sbs] :: FastString -> {-# UNPACK #-} !ShortByteString -- | Lazily computed Z-encoding of this string. See Note [Z-Encoding] in -- GHC.Utils.Encoding. -- -- Since FastStrings are globally memoized this is computed at -- most once for any given string. [fs_zenc] :: FastString -> FastZString zString :: FastZString -> String -- | Returns a Z-encoded version of a FastString. This might be the -- original, if it was already Z-encoded. The first time this function is -- applied to a particular FastString, the results are memoized. zEncodeFS :: FastString -> FastZString unsafeMkByteString :: String -> ByteString -- | Decode a PtrString back into a String using Latin-1 -- encoding. This does not free the memory associated with -- PtrString. unpackPtrString :: PtrString -> String -- | Unpacks and decodes the FastString unpackFS :: FastString -> String uniqueOfFS :: FastString -> Int -- | Compare FastString by their Unique (not lexically). -- -- Much cheaper than lexicalCompareFS but non-deterministic! uniqCompareFS :: FastString -> FastString -> Ordering unconsFS :: FastString -> Maybe (Char, FastString) sLit :: String -> PtrString -- | Returns True if the FastString is empty nullFS :: FastString -> Bool nilFS :: FastString -- | Wrap an unboxed address into a PtrString. mkPtrString# :: Addr# -> PtrString -- | Encode a String into a newly allocated PtrString using -- Latin-1 encoding. The original string must not contain non-Latin-1 -- characters (above codepoint 0xff). mkPtrString :: String -> PtrString -- | Create a FastString from an existing ShortByteString -- without copying. mkFastStringShortByteString :: ShortByteString -> FastString mkFastStringBytes :: Ptr Word8 -> Int -> FastString -- | Create a FastString by copying an existing ByteString mkFastStringByteString :: ByteString -> FastString -- | Creates a FastString from a UTF-8 encoded [Word8] mkFastStringByteList :: [Word8] -> FastString mkFastString# :: Addr# -> FastString -- | Creates a UTF-8 encoded FastString from a String mkFastString :: String -> FastString -- | Compare FastString lexically -- -- If you don't care about the lexical ordering, use uniqCompareFS -- instead. lexicalCompareFS :: FastString -> FastString -> Ordering -- | Return the length of a PtrString lengthPS :: PtrString -> Int lengthFZS :: FastZString -> Int -- | Returns the length of the FastString in characters lengthFS :: FastString -> Int isUnderscoreFS :: FastString -> Bool headFS :: FastString -> Char hPutFZS :: Handle -> FastZString -> IO () -- | Outputs a FastString with no decoding at all, that is, -- you get the actual bytes in the FastString written to the -- Handle. hPutFS :: Handle -> FastString -> IO () getFastStringZEncCounter :: IO Int getFastStringTable :: IO [[[FastString]]] fsLit :: String -> FastString fastZStringToByteString :: FastZString -> ByteString fastStringToShortByteString :: FastString -> ShortByteString -- | Gives the Modified UTF-8 encoded bytes corresponding to a -- FastString fastStringToByteString :: FastString -> ByteString consFS :: Char -> FastString -> FastString concatFS :: [FastString] -> FastString -- | Gives the Modified UTF-8 encoded bytes corresponding to a -- FastString bytesFS :: FastString -> ByteString appendFS :: FastString -> FastString -> FastString data SDocContext SDC :: !PprStyle -> !Scheme -> !PprColour -> !Bool -> !Int -> !Int -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !FastString -> SDoc -> SDocContext [sdocStyle] :: SDocContext -> !PprStyle [sdocColScheme] :: SDocContext -> !Scheme -- | The most recently used colour. This allows nesting colours. [sdocLastColour] :: SDocContext -> !PprColour [sdocShouldUseColor] :: SDocContext -> !Bool [sdocDefaultDepth] :: SDocContext -> !Int [sdocLineLength] :: SDocContext -> !Int -- | True if Unicode encoding is supported and not disable by -- GHC_NO_UNICODE environment variable [sdocCanUseUnicode] :: SDocContext -> !Bool [sdocHexWordLiterals] :: SDocContext -> !Bool [sdocPprDebug] :: SDocContext -> !Bool [sdocPrintUnicodeSyntax] :: SDocContext -> !Bool [sdocPrintCaseAsLet] :: SDocContext -> !Bool [sdocPrintTypecheckerElaboration] :: SDocContext -> !Bool [sdocPrintAxiomIncomps] :: SDocContext -> !Bool [sdocPrintExplicitKinds] :: SDocContext -> !Bool [sdocPrintExplicitCoercions] :: SDocContext -> !Bool [sdocPrintExplicitRuntimeReps] :: SDocContext -> !Bool [sdocPrintExplicitForalls] :: SDocContext -> !Bool [sdocPrintPotentialInstances] :: SDocContext -> !Bool [sdocPrintEqualityRelations] :: SDocContext -> !Bool [sdocSuppressTicks] :: SDocContext -> !Bool [sdocSuppressTypeSignatures] :: SDocContext -> !Bool [sdocSuppressTypeApplications] :: SDocContext -> !Bool [sdocSuppressIdInfo] :: SDocContext -> !Bool [sdocSuppressCoercions] :: SDocContext -> !Bool [sdocSuppressUnfoldings] :: SDocContext -> !Bool [sdocSuppressVarKinds] :: SDocContext -> !Bool [sdocSuppressUniques] :: SDocContext -> !Bool [sdocSuppressModulePrefixes] :: SDocContext -> !Bool [sdocSuppressStgExts] :: SDocContext -> !Bool [sdocErrorSpans] :: SDocContext -> !Bool [sdocStarIsType] :: SDocContext -> !Bool [sdocLinearTypes] :: SDocContext -> !Bool [sdocImpredicativeTypes] :: SDocContext -> !Bool [sdocPrintTypeAbbreviations] :: SDocContext -> !Bool -- | Used to map UnitIds to more friendly "package-version:component" -- strings while pretty-printing. -- -- Use pprWithUnitState to set it. Users should never have to set -- it to pretty-print SDocs emitted by GHC, otherwise it's a bug. It's an -- internal field used to thread the UnitState so that the Outputable -- instance of UnitId can use it. -- -- See Note [Pretty-printing UnitId] in GHC.Unit for more details. -- -- Note that we use FastString instead of UnitId to avoid -- boring module inter-dependency issues. [sdocUnitIdForUser] :: SDocContext -> !FastString -> SDoc -- | Represents a pretty-printable document. -- -- To display an SDoc, use printSDoc, printSDocLn, -- bufLeftRenderSDoc, or renderWithContext. Avoid calling -- runSDoc directly as it breaks the abstraction layer. data SDoc data PprStyle PprUser :: PrintUnqualified -> Depth -> Coloured -> PprStyle PprDump :: PrintUnqualified -> PprStyle -- | Print code; either C or assembler PprCode :: LabelStyle -> PprStyle text :: String -> SDoc zipWithAndUnzipM :: Monad m => (a -> b -> m (c, d)) -> [a] -> [b] -> m ([c], [d]) zipWith4M :: Monad m => (a -> b -> c -> d -> m e) -> [a] -> [b] -> [c] -> [d] -> m [e] zipWith3M_ :: Monad m => (a -> b -> c -> m d) -> [a] -> [b] -> [c] -> m () zipWith3M :: Monad m => (a -> b -> c -> m d) -> [a] -> [b] -> [c] -> m [d] -- | Monadic version of when, taking the condition in the monad whenM :: Monad m => m Bool -> m () -> m () -- | Monadic version of unless, taking the condition in the monad unlessM :: Monad m => m Bool -> m () -> m () -- | Monadic version of or orM :: Monad m => m Bool -> m Bool -> m Bool -- | Monadic version of fmap specialised for Maybe maybeMapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) -- | Monadic version of mapSnd mapSndM :: Monad m => (b -> m c) -> [(a, b)] -> m [(a, c)] -- | Applicative version of mapMaybe mapMaybeM :: Applicative m => (a -> m (Maybe b)) -> [a] -> m [b] mapAndUnzip5M :: Monad m => (a -> m (b, c, d, e, f)) -> [a] -> m ([b], [c], [d], [e], [f]) mapAndUnzip4M :: Monad m => (a -> m (b, c, d, e)) -> [a] -> m ([b], [c], [d], [e]) -- | mapAndUnzipM for triples mapAndUnzip3M :: Monad m => (a -> m (b, c, d)) -> [a] -> m ([b], [c], [d]) -- | Monadic version of mapAccumL mapAccumLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y]) liftSndM :: Monad m => (a -> b) -> m (r, a) -> m (r, b) liftFstM :: Monad m => (a -> b) -> m (a, r) -> m (b, r) -- | Monadic version of foldl that discards its result foldlM_ :: (Monad m, Foldable t) => (a -> b -> m a) -> a -> t b -> m () -- | Monadic version of fmap fmapMaybeM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) -- | Monadic version of fmap fmapEitherM :: Monad m => (a -> m b) -> (c -> m d) -> Either a c -> m (Either b d) -- | Like filterM, only it reverses the sense of the test. filterOutM :: Applicative m => (a -> m Bool) -> [a] -> m [a] -- | Monadic version of concatMap concatMapM :: Monad m => (a -> m [b]) -> [a] -> m [b] -- | Monadic version of any, aborts the computation at the first -- True value anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool -- | Monad version of all, aborts the computation at the first -- False value allM :: Monad m => (a -> m Bool) -> [a] -> m Bool -- | A ModuleName is essentially a simple string, e.g. Data.List. data ModuleName -- | A static plugin with its arguments. For registering compiled-in -- plugins through the GHC API. data StaticPlugin StaticPlugin :: PluginWithArgs -> StaticPlugin -- | the actual plugin together with its commandline arguments [spPlugin] :: StaticPlugin -> PluginWithArgs -- | A plugin with its arguments. The result of loading the plugin. data LoadedPlugin LoadedPlugin :: PluginWithArgs -> ModIface -> LoadedPlugin -- | the actual plugin together with its commandline arguments [lpPlugin] :: LoadedPlugin -> PluginWithArgs -- | the module containing the plugin [lpModule] :: LoadedPlugin -> ModIface -- | Foreign formats supported by GHC via TH data ForeignSrcLang -- | C LangC :: ForeignSrcLang -- | C++ LangCxx :: ForeignSrcLang -- | Objective C LangObjc :: ForeignSrcLang -- | Objective C++ LangObjcxx :: ForeignSrcLang -- | Assembly language (.s) LangAsm :: ForeignSrcLang -- | Object (.o) RawObject :: ForeignSrcLang liftedRepName :: Name mkLexicalFastString :: FastString -> LexicalFastString fromLexicalFastString :: LexicalFastString -> FastString collectHsBindBinders' :: HsBindLR GhcRn idR -> [Name] collectPatBinders' :: LPat GhcRn -> [Name] mkWildValBinder' :: Type -> Id pprTypeForUser' :: Type -> SDoc showSDocOneLine' :: SDoc -> String findImportedModule' :: ModuleName -> TcPluginM FindResult findPluginModule' :: ModuleName -> TcM FindResult pattern HsLet' :: XLet GhcRn -> LetToken -> Located (HsLocalBinds GhcRn) -> InToken -> LHsExpr GhcRn -> HsExpr GhcRn pattern LetStmt' :: XLetStmt GhcRn GhcRn body -> Located (HsLocalBinds GhcRn) -> StmtLR GhcRn GhcRn body pattern ExplicitList' :: XExplicitList p -> [LHsExpr p] -> HsExpr p pattern OverLit' :: OverLitVal -> HsOverLit GhcRn pattern CDictCan' :: CtEvidence -> Class -> [Xi] -> Ct module Debug.Breakpoint.TimerManager -- | has the effect of suspending timeouts while an action is occurring. -- This is only used for GHC >= 9.2 because the semantics are too -- strange without the ability to freeze the runtime. suspendTimeouts :: IO a -> IO a module Debug.Breakpoint plugin :: Plugin -- | Sets a breakpoint in pure code breakpoint :: a -> a -- | Sets a breakpoint in an arbitrary Applicative. Uses -- unsafePerformIO which means that laziness and common -- sub-expression elimination can result in the breakpoint not being hit -- as expected. For this reason, you should prefer breakpointIO if -- a MonadIO instance is available. breakpointM :: Applicative m => m () -- | Sets a breakpoint in an IO based Monad. You should favor -- this over breakpointM if the monad can perform IO. breakpointIO :: MonadIO m => m () -- | When evaluated, displays the names of variables visible from the -- callsite and starts a prompt where entering a variable will display -- its value. You may want to use this instead of breakpoint if -- there are value which should stay unevaluated or you are only -- interested in certain values. Only the current thread is blocked while -- the prompt is active. To resume execution, press enter with a blank -- prompt. queryVars :: a -> a -- | Similar to queryVars but for use in an arbitrary -- Applicative context. This uses unsafePerformIO which -- means that laziness and common sub-expression elimination can result -- in unexpected behavior. For this reason you should prefer -- queryVarsIO if a MonadIO instance is available. queryVarsM :: Applicative m => m () -- | Similar to queryVars but specialized to an IO context. -- You should favor this over queryVarsM if a MonadIO -- instance is available. queryVarsIO :: MonadIO m => m () -- | Excludes the given variable names from appearing in the output of any -- breakpoints occurring in the given expression. excludeVars :: [String] -> a -> a -- | Constructs a lazy Map from the names of all visible variables -- at the call site to a string representation of their value. Does not -- include any variables whose definitions contain it. Be careful not to -- assign multiple variables to captureVars in the same scope as -- this will result in an infinite recursion. captureVars :: Map String String showLev :: ShowLev rep a => a -> String fromAscList :: Ord k => [(k, v)] -> Map k v printAndWait :: String -> Map String String -> a -> a printAndWaitM :: Applicative m => String -> Map String String -> m () printAndWaitIO :: MonadIO m => String -> Map String String -> m () runPrompt :: String -> Map String String -> a -> a runPromptM :: Applicative m => String -> Map String String -> m () runPromptIO :: forall m. MonadIO m => String -> Map String String -> m () -- | Pretty prints the source code location of its call site getSrcLoc :: String instance GHC.Show.Show a => Debug.Breakpoint.Succeed a instance Debug.Breakpoint.ShowLev GHC.Types.LiftedRep a => GHC.Show.Show (Debug.Breakpoint.ShowWrapper a) instance Debug.Breakpoint.ShowLev 'GHC.Types.IntRep GHC.Prim.Int# instance Debug.Breakpoint.ShowLev 'GHC.Types.Int8Rep GHC.Prim.Int8# instance Debug.Breakpoint.ShowLev 'GHC.Types.Int16Rep GHC.Prim.Int16# instance Debug.Breakpoint.ShowLev 'GHC.Types.Int32Rep GHC.Prim.Int32# instance Debug.Breakpoint.ShowLev 'GHC.Types.WordRep GHC.Prim.Word# instance Debug.Breakpoint.ShowLev 'GHC.Types.Word8Rep GHC.Prim.Word8# instance Debug.Breakpoint.ShowLev 'GHC.Types.Word16Rep GHC.Prim.Word16# instance Debug.Breakpoint.ShowLev 'GHC.Types.Word32Rep GHC.Prim.Word32# instance Debug.Breakpoint.ShowLev 'GHC.Types.FloatRep GHC.Prim.Float# instance Debug.Breakpoint.ShowLev 'GHC.Types.DoubleRep GHC.Prim.Double#