-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Utilities for writing GHC type-checker plugins
--   
--   Utilities for writing GHC type-checker plugins, such as creating
--   constraints, with a stable API covering multiple GHC releases.
@package ghc-tcplugins-extra
@version 0.4.6


module GHC.TcPluginM.Extra

-- | Create a new Wanted constraint with the given <a>CtLoc</a>.
newWanted :: CtLoc -> PredType -> TcPluginM CtEvidence

-- | Create a new [G]iven constraint, with the supplied evidence. This must
--   not be invoked from <tt>tcPluginInit</tt> or <tt>tcPluginStop</tt>, or
--   it will panic.
newGiven :: EvBindsVar -> CtLoc -> PredType -> EvTerm -> TcPluginM CtEvidence

-- | The <a>EvTerm</a> equivalent for <a>unsafeCoerce</a>
evByFiat :: String -> Type -> Type -> EvTerm

-- | Find a module
lookupModule :: ModuleName -> FastString -> TcPluginM Module

-- | Find a <a>Name</a> in a <a>Module</a> given an <a>OccName</a>
lookupName :: Module -> OccName -> TcPluginM Name

-- | Print out extra information about the initialisation, stop, and every
--   run of the plugin when <tt>-ddump-tc-trace</tt> is enabled.
tracePlugin :: String -> TcPlugin -> TcPlugin

-- | Flattens evidence of constraints by substituting each others
--   equalities.
--   
--   <b>NB:</b> Should only be used on <i>[G]iven</i> constraints!
--   
--   <b>NB:</b> Doesn't flatten under binders
flattenGivens :: [Ct] -> [Ct]

-- | Create simple substitution from type equalities
mkSubst :: Ct -> Maybe ((TcTyVar, TcType), Ct)

-- | Create flattened substitutions from type equalities, i.e. the
--   substitutions have been applied to each others right hand sides.
mkSubst' :: [Ct] -> [((TcTyVar, TcType), Ct)]

-- | Apply substitutions in Types
--   
--   <b>NB:</b> Doesn't substitute under binders
substType :: [(TcTyVar, TcType)] -> TcType -> TcType

-- | Apply substitution in the evidence of Cts
substCt :: [(TcTyVar, TcType)] -> Ct -> Ct
