import RnHsSyn
import TcRnMonad
import RnTypes ( rnHsSigType, rnLHsType, checkPrecMatch)
-import RnPat (rnPatsAndThen_LocalRightwards, rnBindPat,
+import RnPat (rnPats, rnBindPat,
NameMaker, localRecNameMaker, topRecNameMaker, applyNameMaker
)
import FastString
import Data.List ( partition )
import Maybes ( orElse )
-import Monad ( foldM, unless )
+import Control.Monad
\end{code}
-- ToDo: Put the annotations into the monad, so that they arrive in the proper
rnTopBindsLHS :: MiniFixityEnv
-> HsValBinds RdrName
-> RnM (HsValBindsLR Name RdrName)
-rnTopBindsLHS fix_env binds =
- (uncurry $ rnValBindsLHSFromDoc (topRecNameMaker fix_env)) (bindersAndDoc binds) binds
+rnTopBindsLHS fix_env binds
+ = do { let (boundNames,doc) = bindersAndDoc binds
+ ; mod <- getModule
+ ; rnValBindsLHSFromDoc (topRecNameMaker mod fix_env) boundNames doc binds }
rnTopBindsRHS :: NameSet -- Names bound by these binds
-> HsValBindsLR Name RdrName
fun_tick = fun_tick
}))
= setSrcSpan loc $
- do { (newname, _fvs) <- applyNameMaker name_maker name $ \ newname ->
- return (newname, emptyFVs)
+ do { newname <- applyNameMaker name_maker name
; return (L loc (FunBind { fun_id = L nameLoc newname,
fun_infix = inf,
fun_matches = matches,
rnMethodBind cls sig_fn gen_tyvars (L loc (FunBind { fun_id = name, fun_infix = inf,
fun_matches = MatchGroup matches _ }))
= setSrcSpan loc $ do
- sel_name <- lookupInstDeclBndr cls name
+ sel_name <- wrapLocM (lookupInstDeclBndr cls) name
let plain_name = unLoc sel_name
-- We use the selector name as the binder
renameSig :: Maybe NameSet -> Sig RdrName -> RnM (Sig Name)
-- FixitySig is renamed elsewhere.
+renameSig _ (IdSig x)
+ = return (IdSig x) -- Actually this never occurs
renameSig mb_names sig@(TypeSig v ty)
= do { new_v <- lookupSigOccRn mb_names sig v
; new_ty <- rnHsSigType (quotes (ppr v)) ty
-- Now the main event
-- note that there are no local ficity decls for matches
- ; rnPatsAndThen_LocalRightwards ctxt pats $ \ pats' -> do
+ ; rnPats ctxt pats $ \ pats' -> do
{ (grhss', grhss_fvs) <- rnGRHSs ctxt grhss
; return (Match pats' Nothing grhss', grhss_fvs) }}