summaryrefslogtreecommitdiff
path: root/compiler/hsSyn
diff options
context:
space:
mode:
authorsimonpj@microsoft.com <unknown>2006-09-29 14:39:10 +0000
committersimonpj@microsoft.com <unknown>2006-09-29 14:39:10 +0000
commite6d057711f4d6d6ff6342c39fa2b9e44d25447f1 (patch)
tree2bed37a9ed606633b1eba10e6f1881f74a822ef3 /compiler/hsSyn
parentf80b81f8b56ebd0fa0f7f82494a5090e9ab64256 (diff)
downloadhaskell-e6d057711f4d6d6ff6342c39fa2b9e44d25447f1.tar.gz
Global renamings in HsSyn
Diffstat (limited to 'compiler/hsSyn')
-rw-r--r--compiler/hsSyn/HsBinds.lhs84
-rw-r--r--compiler/hsSyn/HsExpr.lhs6
-rw-r--r--compiler/hsSyn/HsPat.lhs10
-rw-r--r--compiler/hsSyn/HsUtils.lhs14
4 files changed, 57 insertions, 57 deletions
diff --git a/compiler/hsSyn/HsBinds.lhs b/compiler/hsSyn/HsBinds.lhs
index 300f683c1c..0588047695 100644
--- a/compiler/hsSyn/HsBinds.lhs
+++ b/compiler/hsSyn/HsBinds.lhs
@@ -76,7 +76,7 @@ data HsBind id
fun_matches :: MatchGroup id, -- The payload
- fun_co_fn :: ExprCoFn, -- Coercion from the type of the MatchGroup to the type of
+ fun_co_fn :: HsWrapper, -- Coercion from the type of the MatchGroup to the type of
-- the Id. Example:
-- f :: Int -> forall a. a -> a
-- f x y = y
@@ -296,67 +296,67 @@ instance (OutputableBndr id) => Outputable (IPBind id) where
%************************************************************************
\begin{code}
--- A ExprCoFn is an expression with a hole in it
+-- A HsWrapper is an expression with a hole in it
-- We need coercions to have concrete form so that we can zonk them
-data ExprCoFn
- = CoHole -- The identity coercion
+data HsWrapper
+ = WpHole -- The identity coercion
- | CoCompose ExprCoFn ExprCoFn -- (\a1..an. []) `CoCompose` (\x1..xn. [])
+ | WpCompose HsWrapper HsWrapper -- (\a1..an. []) `WpCompose` (\x1..xn. [])
-- = (\a1..an \x1..xn. [])
- | ExprCoFn Coercion -- A cast: [] `cast` co
+ | WpCo Coercion -- A cast: [] `cast` co
-- Guaranteedn not the identity coercion
- | CoApp Var -- [] x; the xi are dicts or coercions
- | CoTyApp Type -- [] t
- | CoLam Id -- \x. []; the xi are dicts or coercions
- | CoTyLam TyVar -- \a. []
+ | WpApp Var -- [] x; the xi are dicts or coercions
+ | WpTyApp Type -- [] t
+ | WpLam Id -- \x. []; the xi are dicts or coercions
+ | WpTyLam TyVar -- \a. []
-- Non-empty bindings, so that the identity coercion
- -- is always exactly CoHole
- | CoLet (LHsBinds Id) -- let binds in []
+ -- is always exactly WpHole
+ | WpLet (LHsBinds Id) -- let binds in []
-- (would be nicer to be core bindings)
-instance Outputable ExprCoFn where
- ppr co_fn = pprCoFn (ptext SLIT("<>")) co_fn
+instance Outputable HsWrapper where
+ ppr co_fn = pprHsWrapper (ptext SLIT("<>")) co_fn
-pprCoFn :: SDoc -> ExprCoFn -> SDoc
-pprCoFn it CoHole = it
-pprCoFn it (CoCompose f1 f2) = pprCoFn (pprCoFn it f2) f1
-pprCoFn it (ExprCoFn co) = it <+> ptext SLIT("`cast`") <+> pprParendType co
-pprCoFn it (CoApp id) = it <+> ppr id
-pprCoFn it (CoTyApp ty) = it <+> ptext SLIT("@") <+> pprParendType ty
-pprCoFn it (CoLam id) = ptext SLIT("\\") <> pprBndr LambdaBind id <> dot <+> it
-pprCoFn it (CoTyLam tv) = ptext SLIT("/\\") <> pprBndr LambdaBind tv <> dot <+> it
-pprCoFn it (CoLet binds) = sep [ptext SLIT("let") <+> braces (ppr binds), it]
+pprHsWrapper :: SDoc -> HsWrapper -> SDoc
+pprHsWrapper it WpHole = it
+pprHsWrapper it (WpCompose f1 f2) = pprHsWrapper (pprHsWrapper it f2) f1
+pprHsWrapper it (WpCo co) = it <+> ptext SLIT("`cast`") <+> pprParendType co
+pprHsWrapper it (WpApp id) = it <+> ppr id
+pprHsWrapper it (WpTyApp ty) = it <+> ptext SLIT("@") <+> pprParendType ty
+pprHsWrapper it (WpLam id) = ptext SLIT("\\") <> pprBndr LambdaBind id <> dot <+> it
+pprHsWrapper it (WpTyLam tv) = ptext SLIT("/\\") <> pprBndr LambdaBind tv <> dot <+> it
+pprHsWrapper it (WpLet binds) = sep [ptext SLIT("let") <+> braces (ppr binds), it]
-(<.>) :: ExprCoFn -> ExprCoFn -> ExprCoFn
-CoHole <.> c = c
-c <.> CoHole = c
-c1 <.> c2 = c1 `CoCompose` c2
+(<.>) :: HsWrapper -> HsWrapper -> HsWrapper
+WpHole <.> c = c
+c <.> WpHole = c
+c1 <.> c2 = c1 `WpCompose` c2
-mkCoTyApps :: [Type] -> ExprCoFn
-mkCoTyApps tys = mk_co_fn CoTyApp (reverse tys)
+mkWpTyApps :: [Type] -> HsWrapper
+mkWpTyApps tys = mk_co_fn WpTyApp (reverse tys)
-mkCoApps :: [Id] -> ExprCoFn
-mkCoApps ids = mk_co_fn CoApp (reverse ids)
+mkWpApps :: [Id] -> HsWrapper
+mkWpApps ids = mk_co_fn WpApp (reverse ids)
-mkCoTyLams :: [TyVar] -> ExprCoFn
-mkCoTyLams ids = mk_co_fn CoTyLam ids
+mkWpTyLams :: [TyVar] -> HsWrapper
+mkWpTyLams ids = mk_co_fn WpTyLam ids
-mkCoLams :: [Id] -> ExprCoFn
-mkCoLams ids = mk_co_fn CoLam ids
+mkWpLams :: [Id] -> HsWrapper
+mkWpLams ids = mk_co_fn WpLam ids
-mk_co_fn :: (a -> ExprCoFn) -> [a] -> ExprCoFn
-mk_co_fn f as = foldr (CoCompose . f) CoHole as
+mk_co_fn :: (a -> HsWrapper) -> [a] -> HsWrapper
+mk_co_fn f as = foldr (WpCompose . f) WpHole as
-idCoercion :: ExprCoFn
-idCoercion = CoHole
+idHsWrapper :: HsWrapper
+idHsWrapper = WpHole
-isIdCoercion :: ExprCoFn -> Bool
-isIdCoercion CoHole = True
-isIdCoercion other = False
+isIdHsWrapper :: HsWrapper -> Bool
+isIdHsWrapper WpHole = True
+isIdHsWrapper other = False
\end{code}
diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs
index c42be908bd..40866f44d7 100644
--- a/compiler/hsSyn/HsExpr.lhs
+++ b/compiler/hsSyn/HsExpr.lhs
@@ -15,7 +15,7 @@ import HsLit ( HsLit(..), HsOverLit )
import HsTypes ( LHsType, PostTcType )
import HsImpExp ( isOperator, pprHsVar )
import HsBinds ( HsLocalBinds, DictBinds, isEmptyLocalBinds,
- ExprCoFn, pprCoFn )
+ HsWrapper, pprHsWrapper )
-- others:
import Type ( Type, pprParendType )
@@ -240,7 +240,7 @@ The renamer translates them into the Right Thing.
Everything from here on appears only in typechecker output.
\begin{code}
- | HsCoerce ExprCoFn -- TRANSLATION
+ | HsWrap HsWrapper -- TRANSLATION
(HsExpr id)
type PendingSplice = (Name, LHsExpr Id) -- Typechecked splices, waiting to be
@@ -380,7 +380,7 @@ ppr_expr (EAsPat v e) = ppr v <> char '@' <> pprParendExpr e
ppr_expr (HsSCC lbl expr)
= sep [ ptext SLIT("_scc_") <+> doubleQuotes (ftext lbl), pprParendExpr expr ]
-ppr_expr (HsCoerce co_fn e) = pprCoFn (ppr_expr e) co_fn
+ppr_expr (HsWrap co_fn e) = pprHsWrapper (ppr_expr e) co_fn
ppr_expr (HsType id) = ppr id
ppr_expr (HsSpliceE s) = pprSplice s
diff --git a/compiler/hsSyn/HsPat.lhs b/compiler/hsSyn/HsPat.lhs
index aa1568d27f..79b906207b 100644
--- a/compiler/hsSyn/HsPat.lhs
+++ b/compiler/hsSyn/HsPat.lhs
@@ -22,7 +22,7 @@ module HsPat (
import {-# SOURCE #-} HsExpr ( SyntaxExpr )
-- friends:
-import HsBinds ( DictBinds, HsBind(..), ExprCoFn, isIdCoercion, pprCoFn,
+import HsBinds ( DictBinds, HsBind(..), HsWrapper, isIdHsWrapper, pprHsWrapper,
emptyLHsBinds, pprLHsBinds )
import HsLit ( HsLit(HsCharPrim), HsOverLit )
import HsTypes ( LHsType, PostTcType )
@@ -126,7 +126,7 @@ data Pat id
[id] -- Methods
------------ Pattern coercions (translation only) ---------------
- | CoPat ExprCoFn -- If co::t1 -> t2, p::t2,
+ | CoPat HsWrapper -- If co::t1 -> t2, p::t2,
-- then (CoPat co p) :: t1
(Pat id) -- Why not LPat? Ans: existing locn will do
Type
@@ -195,7 +195,7 @@ pprPat (NPat l Nothing _ _) = ppr l
pprPat (NPat l (Just _) _ _) = char '-' <> ppr l
pprPat (NPlusKPat n k _ _) = hcat [ppr n, char '+', ppr k]
pprPat (TypePat ty) = ptext SLIT("{|") <> ppr ty <> ptext SLIT("|}")
-pprPat (CoPat co pat _) = parens (pprCoFn (ppr pat) co)
+pprPat (CoPat co pat _) = parens (pprHsWrapper (ppr pat) co)
pprPat (SigPatIn pat ty) = ppr pat <+> dcolon <+> ppr ty
pprPat (SigPatOut pat ty) = ppr pat <+> dcolon <+> ppr ty
pprPat (DictPat ds ms) = parens (sep [ptext SLIT("{-dict-}"),
@@ -239,9 +239,9 @@ mkNilPat ty = mkPrefixConPat nilDataCon [] ty
mkCharLitPat :: Char -> OutPat id
mkCharLitPat c = mkPrefixConPat charDataCon [noLoc $ LitPat (HsCharPrim c)] charTy
-mkCoPat :: ExprCoFn -> OutPat id -> Type -> OutPat id
+mkCoPat :: HsWrapper -> OutPat id -> Type -> OutPat id
mkCoPat co lpat@(L loc pat) ty
- | isIdCoercion co = lpat
+ | isIdHsWrapper co = lpat
| otherwise = L loc (CoPat co pat ty)
\end{code}
diff --git a/compiler/hsSyn/HsUtils.lhs b/compiler/hsSyn/HsUtils.lhs
index 1839aefa0d..da0e24c6c1 100644
--- a/compiler/hsSyn/HsUtils.lhs
+++ b/compiler/hsSyn/HsUtils.lhs
@@ -72,14 +72,14 @@ mkHsApp :: LHsExpr name -> LHsExpr name -> LHsExpr name
mkHsApp e1 e2 = addCLoc e1 e2 (HsApp e1 e2)
nlHsTyApp :: name -> [Type] -> LHsExpr name
-nlHsTyApp fun_id tys = noLoc (HsCoerce (mkCoTyApps tys) (HsVar fun_id))
+nlHsTyApp fun_id tys = noLoc (HsWrap (mkWpTyApps tys) (HsVar fun_id))
-mkLHsCoerce :: ExprCoFn -> LHsExpr id -> LHsExpr id
-mkLHsCoerce co_fn (L loc e) = L loc (mkHsCoerce co_fn e)
+mkLHsWrap :: HsWrapper -> LHsExpr id -> LHsExpr id
+mkLHsWrap co_fn (L loc e) = L loc (mkHsWrap co_fn e)
-mkHsCoerce :: ExprCoFn -> HsExpr id -> HsExpr id
-mkHsCoerce co_fn e | isIdCoercion co_fn = e
- | otherwise = HsCoerce co_fn e
+mkHsWrap :: HsWrapper -> HsExpr id -> HsExpr id
+mkHsWrap co_fn e | isIdHsWrapper co_fn = e
+ | otherwise = HsWrap co_fn e
mkHsLam :: [LPat id] -> LHsExpr id -> LHsExpr id
mkHsLam pats body = mkHsPar (L (getLoc body) (HsLam matches))
@@ -224,7 +224,7 @@ nlHsFunTy a b = noLoc (HsFunTy a b)
mkFunBind :: Located id -> [LMatch id] -> HsBind id
-- Not infix, with place holders for coercion and free vars
mkFunBind fn ms = FunBind { fun_id = fn, fun_infix = False, fun_matches = mkMatchGroup ms,
- fun_co_fn = idCoercion, bind_fvs = placeHolderNames }
+ fun_co_fn = idHsWrapper, bind_fvs = placeHolderNames }
mkVarBind :: SrcSpan -> RdrName -> LHsExpr RdrName -> LHsBind RdrName