projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix scoped type variables for expression type signatures
[ghc-hetmet.git]
/
compiler
/
hsSyn
/
HsPat.lhs
diff --git
a/compiler/hsSyn/HsPat.lhs
b/compiler/hsSyn/HsPat.lhs
index
ee21ee3
..
79b9062
100644
(file)
--- a/
compiler/hsSyn/HsPat.lhs
+++ b/
compiler/hsSyn/HsPat.lhs
@@
-22,7
+22,7
@@
module HsPat (
import {-# SOURCE #-} HsExpr ( SyntaxExpr )
-- friends:
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 )
emptyLHsBinds, pprLHsBinds )
import HsLit ( HsLit(HsCharPrim), HsOverLit )
import HsTypes ( LHsType, PostTcType )
@@
-122,14
+122,16
@@
data Pat id
------------ Dictionary patterns (translation only) ---------------
| DictPat -- Used when destructing Dictionaries with an explicit case
------------ Dictionary patterns (translation only) ---------------
| DictPat -- Used when destructing Dictionaries with an explicit case
- [id] -- superclass dicts
- [id] -- methods
+ [id] -- Superclass dicts
+ [id] -- Methods
------------ Pattern coercions (translation only) ---------------
------------ 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
-- then (CoPat co p) :: t1
- (Pat id) -- No nested location reqd
- Type
+ (Pat id) -- Why not LPat? Ans: existing locn will do
+ Type
+ -- During desugaring a (CoPat co pat) turns into a cast with 'co' on
+ -- the scrutinee, followed by a match on 'pat'
\end{code}
HsConDetails is use both for patterns and for data type declarations
\end{code}
HsConDetails is use both for patterns and for data type declarations
@@
-193,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 (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-}"),
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-}"),
@@
-237,9
+239,9
@@
mkNilPat ty = mkPrefixConPat nilDataCon [] ty
mkCharLitPat :: Char -> OutPat id
mkCharLitPat c = mkPrefixConPat charDataCon [noLoc $ LitPat (HsCharPrim c)] charTy
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
mkCoPat co lpat@(L loc pat) ty
- | isIdCoercion co = lpat
+ | isIdHsWrapper co = lpat
| otherwise = L loc (CoPat co pat ty)
\end{code}
| otherwise = L loc (CoPat co pat ty)
\end{code}