X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FdeSugar%2FDsMonad.lhs;h=f24dee4905257e0dbb16c1c0a4f45fc4e697eca0;hb=3c245de9199f522f75ace92219256badbd928bd6;hp=2dbe8b15983d73fd987d2510474ca9233685e583;hpb=4a5870490196e05c40a9362ac2fef0081567bffc;p=ghc-hetmet.git diff --git a/ghc/compiler/deSugar/DsMonad.lhs b/ghc/compiler/deSugar/DsMonad.lhs index 2dbe8b1..f24dee4 100644 --- a/ghc/compiler/deSugar/DsMonad.lhs +++ b/ghc/compiler/deSugar/DsMonad.lhs @@ -5,10 +5,11 @@ \begin{code} module DsMonad ( - DsM, mappM, - initDs, returnDs, thenDs, listDs, fixDs, mapAndUnzipDs, foldlDs, + DsM, mappM, mapAndUnzipM, + initDs, returnDs, thenDs, listDs, fixDs, mapAndUnzipDs, + foldlDs, foldrDs, - newTyVarsDs, + newTyVarsDs, newLocalName, duplicateLocalDs, newSysLocalDs, newSysLocalsDs, newUniqueId, newFailLocalDs, getSrcSpanDs, putSrcSpanDs, @@ -68,7 +69,7 @@ infixr 9 `thenDs` \begin{code} data DsMatchContext - = DsMatchContext (HsMatchContext Name) [Pat Id] SrcSpan + = DsMatchContext (HsMatchContext Name) SrcSpan | NoMatchContext deriving () @@ -82,7 +83,7 @@ idWrapper e = e -- The semantics of (match vs (EqnInfo wrap pats rhs)) is the MatchResult -- \fail. wrap (case vs of { pats -> rhs fail }) --- where vs are not in the domain of wrap +-- where vs are not bound by wrap -- A MatchResult is an expression with a hole in it @@ -119,6 +120,7 @@ thenDs = thenM returnDs = returnM listDs = sequenceM foldlDs = foldlM +foldrDs = foldrM mapAndUnzipDs = mapAndUnzipM @@ -239,8 +241,10 @@ getSrcSpanDs = do { env <- getLclEnv; return (ds_loc env) } putSrcSpanDs :: SrcSpan -> DsM a -> DsM a putSrcSpanDs new_loc thing_inside = updLclEnv (\ env -> env {ds_loc = new_loc}) thing_inside -dsWarn :: DsWarning -> DsM () -dsWarn (loc,warn) = do { env <- getGblEnv; updMutVar (ds_warns env) (`snocBag` (loc,msg)) } +dsWarn :: SDoc -> DsM () +dsWarn warn = do { env <- getGblEnv + ; loc <- getSrcSpanDs + ; updMutVar (ds_warns env) (`snocBag` (loc,msg)) } where msg = ptext SLIT("Warning:") <+> warn \end{code}