{-# LANGUAGE TypeFamilies, UndecidableInstances #-}
module GHC.HsToCore.Types (
DsM, DsLclEnv(..), DsGblEnv(..),
DsMetaEnv, DsMetaVal(..), CompleteMatches
) where
import GHC.Prelude (Int)
import Data.IORef
import GHC.Types.CostCentre.State
import GHC.Types.Error
import GHC.Types.Name.Env
import GHC.Types.SrcLoc
import GHC.Types.Var
import GHC.Types.Name.Reader (GlobalRdrEnv)
import GHC.Hs (LForeignDecl, HsExpr, GhcTc)
import GHC.Tc.Types (TcRnIf, IfGblEnv, IfLclEnv, CompleteMatches)
import GHC.HsToCore.Pmc.Types (Nablas)
import GHC.HsToCore.Errors.Types
import GHC.Core (CoreExpr)
import GHC.Core.FamInstEnv
import GHC.Utils.Outputable as Outputable
import GHC.Unit.Module
import GHC.Driver.Hooks (DsForeignsHook)
import GHC.Data.OrdList (OrdList)
import GHC.Types.ForeignStubs (ForeignStubs)
data DsGblEnv
= DsGblEnv
{ DsGblEnv -> Module
ds_mod :: Module
, DsGblEnv -> FamInstEnv
ds_fam_inst_env :: FamInstEnv
, DsGblEnv -> GlobalRdrEnv
ds_gbl_rdr_env :: GlobalRdrEnv
, DsGblEnv -> NamePprCtx
ds_name_ppr_ctx :: NamePprCtx
, DsGblEnv -> IORef (Messages DsMessage)
ds_msgs :: IORef (Messages DsMessage)
, DsGblEnv -> (IfGblEnv, IfLclEnv)
ds_if_env :: (IfGblEnv, IfLclEnv)
, DsGblEnv -> CompleteMatches
ds_complete_matches :: CompleteMatches
, DsGblEnv -> IORef CostCentreState
ds_cc_st :: IORef CostCentreState
, DsGblEnv -> IORef (ModuleEnv Int)
ds_next_wrapper_num :: IORef (ModuleEnv Int)
}
instance ContainsModule DsGblEnv where
extractModule :: DsGblEnv -> Module
extractModule = DsGblEnv -> Module
ds_mod
data DsLclEnv
= DsLclEnv
{ DsLclEnv -> DsMetaEnv
dsl_meta :: DsMetaEnv
, DsLclEnv -> RealSrcSpan
dsl_loc :: RealSrcSpan
, DsLclEnv -> Nablas
dsl_nablas :: Nablas
}
type DsMetaEnv = NameEnv DsMetaVal
data DsMetaVal
= DsBound Id
| DsSplice (HsExpr GhcTc)
type DsM = TcRnIf DsGblEnv DsLclEnv
type instance DsForeignsHook = [LForeignDecl GhcTc] -> DsM (ForeignStubs, OrdList (Id, CoreExpr))