{-# LANGUAGE TypeFamilies, UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module GHC.HsToCore.Types (
DsM, DsLclEnv(..), DsGblEnv(..),
DsMetaEnv, DsMetaVal(..), CompleteMatches
) where
import GHC.Prelude (Int)
import Data.IORef
import qualified Data.Set as S
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)
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)
import GHC.Types.CompleteMatch
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 -> DsCompleteMatches
ds_complete_matches :: DsCompleteMatches
, 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
, DsLclEnv -> Set EvVar
dsl_unspecables :: S.Set EvVar
}
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))