X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcHsSyn.lhs;h=160170f960222307c21a9cd2a70a20fc84703356;hp=bd3cb8cb4bb40b00ce3b594488e74408bb3a4ebe;hb=6821c8a47c0fc61a2d989d368f926cc0ded776e9;hpb=3787d9878e4d62829a555f01b2a4c5866f24f303 diff --git a/compiler/typecheck/TcHsSyn.lhs b/compiler/typecheck/TcHsSyn.lhs index bd3cb8c..160170f 100644 --- a/compiler/typecheck/TcHsSyn.lhs +++ b/compiler/typecheck/TcHsSyn.lhs @@ -57,6 +57,22 @@ import SrcLoc import Util import Bag import Outputable +import FastString +\end{code} + +\begin{code} +-- XXX +thenM :: Monad a => a b -> (b -> a c) -> a c +thenM = (>>=) + +thenM_ :: Monad a => a b -> a c -> a c +thenM_ = (>>) + +returnM :: Monad m => a -> m a +returnM = return + +mappM :: (Monad m) => (a -> m b) -> [a] -> m [b] +mappM = mapM \end{code} @@ -102,6 +118,7 @@ hsLitType (HsString str) = stringTy hsLitType (HsStringPrim s) = addrPrimTy hsLitType (HsInt i) = intTy hsLitType (HsIntPrim i) = intPrimTy +hsLitType (HsWordPrim w) = wordPrimTy hsLitType (HsInteger i ty) = ty hsLitType (HsRat _ ty) = ty hsLitType (HsFloatPrim f) = floatPrimTy @@ -313,11 +330,10 @@ zonk_bind env (AbsBinds { abs_tvs = tyvars, abs_dicts = dicts, mapM zonk_prag prags `thenM` \ new_prags -> returnM (tyvars, new_global, zonkIdOcc env local, new_prags) zonk_prag prag@(L _ (InlinePrag {})) = return prag - zonk_prag (L loc (SpecPrag expr ty ds inl)) + zonk_prag (L loc (SpecPrag expr ty inl)) = do { expr' <- zonkExpr env expr ; ty' <- zonkTcTypeToType env ty - ; let ds' = zonkIdOccs env ds - ; return (L loc (SpecPrag expr' ty' ds' inl)) } + ; return (L loc (SpecPrag expr' ty' inl)) } \end{code} %************************************************************************ @@ -548,8 +564,8 @@ zonkCoFn env WpInline = return (env, WpInline) zonkCoFn env (WpCompose c1 c2) = do { (env1, c1') <- zonkCoFn env c1 ; (env2, c2') <- zonkCoFn env1 c2 ; return (env2, WpCompose c1' c2') } -zonkCoFn env (WpCo co) = do { co' <- zonkTcTypeToType env co - ; return (env, WpCo co') } +zonkCoFn env (WpCast co) = do { co' <- zonkTcTypeToType env co + ; return (env, WpCast co') } zonkCoFn env (WpLam id) = do { id' <- zonkDictBndr env id ; let env1 = extendZonkEnv1 env id' ; return (env1, WpLam id') } @@ -860,7 +876,7 @@ zonkRules :: ZonkEnv -> [LRuleDecl TcId] -> TcM [LRuleDecl Id] zonkRules env rs = mappM (wrapLocM (zonkRule env)) rs zonkRule :: ZonkEnv -> RuleDecl TcId -> TcM (RuleDecl Id) -zonkRule env (HsRule name act (vars::[RuleBndr TcId]) lhs fv_lhs rhs fv_rhs) +zonkRule env (HsRule name act (vars{-::[RuleBndr TcId]-}) lhs fv_lhs rhs fv_rhs) = mappM zonk_bndr vars `thenM` \ new_bndrs -> newMutVar emptyVarSet `thenM` \ unbound_tv_set -> let @@ -1008,10 +1024,10 @@ mkArbitraryType warn tv (args,res) = splitKindFunTys kind tup_tc = tupleTyCon Boxed (length args) - msg = vcat [ hang (ptext SLIT("Inventing strangely-kinded Any TyCon")) - 2 (ptext SLIT("of kind") <+> quotes (ppr kind)) - , nest 2 (ptext SLIT("from an instantiation of type variable") <+> quotes (ppr tv)) - , ptext SLIT("This warning can be suppressed by a type signature fixing") <+> quotes (ppr tv) - , nest 2 (ptext SLIT("but is harmless without -O (and usually harmless anyway).")) - , ptext SLIT("See http://hackage.haskell.org/trac/ghc/ticket/959 for details") ] + msg = vcat [ hang (ptext (sLit "Inventing strangely-kinded Any TyCon")) + 2 (ptext (sLit "of kind") <+> quotes (ppr kind)) + , nest 2 (ptext (sLit "from an instantiation of type variable") <+> quotes (ppr tv)) + , ptext (sLit "This warning can be suppressed by a type signature fixing") <+> quotes (ppr tv) + , nest 2 (ptext (sLit "but is harmless without -O (and usually harmless anyway).")) + , ptext (sLit "See http://hackage.haskell.org/trac/ghc/ticket/959 for details") ] \end{code}