X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FdeSugar%2FDsMonad.lhs;h=8d119318facc6b55b6b299431405f72819df66c7;hb=376101055fb111ebd52b5ef1fb76e00334b44304;hp=347f6b60612d5f6729234f8d354c5d6d2c106a15;hpb=f1c0fd99f16322fe222c6fcf4626a6162ad0a466;p=ghc-hetmet.git diff --git a/compiler/deSugar/DsMonad.lhs b/compiler/deSugar/DsMonad.lhs index 347f6b6..8d11931 100644 --- a/compiler/deSugar/DsMonad.lhs +++ b/compiler/deSugar/DsMonad.lhs @@ -1,7 +1,9 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -\section[DsMonad]{@DsMonad@: monadery used in desugaring} + +@DsMonad@: monadery used in desugaring \begin{code} module DsMonad ( @@ -16,46 +18,49 @@ module DsMonad ( getModuleDs, newUnique, UniqSupply, newUniqueSupply, - getDOptsDs, + getDOptsDs, getGhcModeDs, doptDs, dsLookupGlobal, dsLookupGlobalId, dsLookupTyCon, dsLookupDataCon, DsMetaEnv, DsMetaVal(..), dsLookupMetaEnv, dsExtendMetaEnv, + getBkptSitesDs, -- Warnings DsWarning, warnDs, failWithDs, -- Data types DsMatchContext(..), - EquationInfo(..), MatchResult(..), DsWrapper, idWrapper, + EquationInfo(..), MatchResult(..), DsWrapper, idDsWrapper, CanItFail(..), orFail ) where #include "HsVersions.h" import TcRnMonad -import CoreSyn ( CoreExpr ) -import HsSyn ( HsExpr, HsMatchContext, Pat ) -import TcIface ( tcIfaceGlobal ) -import RdrName ( GlobalRdrEnv ) -import HscTypes ( TyThing(..), TypeEnv, HscEnv(..), - tyThingId, tyThingTyCon, tyThingDataCon, mkPrintUnqualified ) -import Bag ( emptyBag, snocBag ) -import DataCon ( DataCon ) -import TyCon ( TyCon ) -import Id ( mkSysLocal, setIdUnique, Id ) -import Module ( Module ) -import Var ( TyVar, setTyVarUnique ) +import CoreSyn +import HsSyn +import TcIface +import RdrName +import HscTypes +import Bag +import DataCon +import TyCon +import Id +import Module +import Var import Outputable -import SrcLoc ( noSrcSpan, SrcSpan ) -import Type ( Type ) -import UniqSupply ( UniqSupply, uniqsFromSupply ) -import Name ( Name, nameOccName ) +import SrcLoc +import Type +import UniqSupply +import Name import NameEnv -import OccName ( occNameFS ) -import DynFlags ( DynFlags ) -import ErrUtils ( Messages, mkWarnMsg, mkErrMsg, - printErrorsAndWarnings, errorsFound ) -import DATA_IOREF ( newIORef, readIORef ) +import OccName +import DynFlags +import ErrUtils +import Bag +import Breakpoints +import OccName + +import Data.IORef infixr 9 `thenDs` \end{code} @@ -77,7 +82,7 @@ data EquationInfo eqn_rhs :: MatchResult } -- What to do after match type DsWrapper = CoreExpr -> CoreExpr -idWrapper e = e +idDsWrapper e = e -- The semantics of (match vs (EqnInfo wrap pats rhs)) is the MatchResult -- \fail. wrap (case vs of { pats -> rhs fail }) @@ -131,8 +136,9 @@ data DsGblEnv = DsGblEnv { ds_mod :: Module, -- For SCC profiling ds_unqual :: PrintUnqualified, ds_msgs :: IORef Messages, -- Warning messages - ds_if_env :: (IfGblEnv, IfLclEnv) -- Used for looking up global, + ds_if_env :: (IfGblEnv, IfLclEnv), -- Used for looking up global, -- possibly-imported things + ds_bkptSites :: IORef SiteMap -- Inserted Breakpoints sites } data DsLclEnv = DsLclEnv { @@ -255,6 +261,12 @@ the @SrcSpan@ being carried around. getDOptsDs :: DsM DynFlags getDOptsDs = getDOpts +doptDs :: DynFlag -> TcRnIf gbl lcl Bool +doptDs = doptM + +getGhcModeDs :: DsM GhcMode +getGhcModeDs = getDOptsDs >>= return . ghcMode + getModuleDs :: DsM Module getModuleDs = do { env <- getGblEnv; return (ds_mod env) } @@ -315,4 +327,10 @@ dsExtendMetaEnv menv thing_inside = updLclEnv (\env -> env { ds_meta = ds_meta env `plusNameEnv` menv }) thing_inside \end{code} +\begin{code} + +getBkptSitesDs :: DsM (IORef SiteMap) +getBkptSitesDs = do { env <- getGblEnv; return (ds_bkptSites env) } + +\end{code}