projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Comment typo
[ghc-hetmet.git]
/
compiler
/
hsSyn
/
HsPat.lhs
diff --git
a/compiler/hsSyn/HsPat.lhs
b/compiler/hsSyn/HsPat.lhs
index
6b294c1
..
0320706
100644
(file)
--- a/
compiler/hsSyn/HsPat.lhs
+++ b/
compiler/hsSyn/HsPat.lhs
@@
-28,8
+28,6
@@
module HsPat (
patsAreAllLits, isLitPat, isIrrefutableHsPat
) where
patsAreAllLits, isLitPat, isIrrefutableHsPat
) where
-#include "HsVersions.h"
-
import {-# SOURCE #-} HsExpr (SyntaxExpr, LHsExpr, pprLExpr)
-- friends:
import {-# SOURCE #-} HsExpr (SyntaxExpr, LHsExpr, pprLExpr)
-- friends:
@@
-263,9
+261,9
@@
pprPat (NPat l (Just _) _) = char '-' <> ppr l
pprPat (NPlusKPat n k _ _) = hcat [ppr n, char '+', ppr k]
pprPat (QuasiQuotePat (HsQuasiQuote name quoter _ quote))
= char '$' <> brackets (ppr name) <>
pprPat (NPlusKPat n k _ _) = hcat [ppr n, char '+', ppr k]
pprPat (QuasiQuotePat (HsQuasiQuote name quoter _ quote))
= char '$' <> brackets (ppr name) <>
- ptext SLIT("[:") <> ppr quoter <> ptext SLIT("|") <>
- ppr quote <> ptext SLIT("|]")
-pprPat (TypePat ty) = ptext SLIT("{|") <> ppr ty <> ptext SLIT("|}")
+ ptext (sLit "[:") <> ppr quoter <> ptext (sLit "|") <>
+ ppr quote <> ptext (sLit "|]")
+pprPat (TypePat ty) = ptext (sLit "{|") <> ppr ty <> ptext (sLit "|}")
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 (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
@@
-286,7
+284,7
@@
instance (OutputableBndr id, Outputable arg)
ppr (HsRecFields { rec_flds = flds, rec_dotdot = Just n })
= braces (fsep (punctuate comma (map ppr (take n flds) ++ [dotdot])))
where
ppr (HsRecFields { rec_flds = flds, rec_dotdot = Just n })
= braces (fsep (punctuate comma (map ppr (take n flds) ++ [dotdot])))
where
- dotdot = ptext SLIT("..") <+> ifPprDebug (ppr (drop n flds))
+ dotdot = ptext (sLit "..") <+> ifPprDebug (ppr (drop n flds))
instance (OutputableBndr id, Outputable arg)
=> Outputable (HsRecField id arg) where
instance (OutputableBndr id, Outputable arg)
=> Outputable (HsRecField id arg) where
@@
-297,7
+295,7
@@
instance (OutputableBndr id, Outputable arg)
-- add parallel array brackets around a document
--
pabrackets :: SDoc -> SDoc
-- add parallel array brackets around a document
--
pabrackets :: SDoc -> SDoc
-pabrackets p = ptext SLIT("[:") <> p <> ptext SLIT(":]")
+pabrackets p = ptext (sLit "[:") <> p <> ptext (sLit ":]")
\end{code}
\end{code}
@@
-328,7
+326,7
@@
mkCoPat co pat ty
mkCoPatCoI :: CoercionI -> Pat id -> Type -> Pat id
mkCoPatCoI IdCo pat _ = pat
mkCoPatCoI :: CoercionI -> Pat id -> Type -> Pat id
mkCoPatCoI IdCo pat _ = pat
-mkCoPatCoI (ACo co) pat ty = mkCoPat (WpCo co) pat ty
+mkCoPatCoI (ACo co) pat ty = mkCoPat (WpCast co) pat ty
\end{code}
\end{code}
@@
-398,7
+396,7
@@
isBangHsBind :: HsBind id -> Bool
isBangHsBind (PatBind { pat_lhs = L _ (BangPat _) }) = True
isBangHsBind _ = False
isBangHsBind (PatBind { pat_lhs = L _ (BangPat _) }) = True
isBangHsBind _ = False
-isIrrefutableHsPat :: LPat id -> Bool
+isIrrefutableHsPat :: OutputableBndr id => LPat id -> Bool
-- (isIrrefutableHsPat p) is true if matching against p cannot fail,
-- in the sense of falling through to the next pattern.
-- (NB: this is not quite the same as the (silly) defn
-- (isIrrefutableHsPat p) is true if matching against p cannot fail,
-- in the sense of falling through to the next pattern.
-- (NB: this is not quite the same as the (silly) defn
@@
-436,6
+434,10
@@
isIrrefutableHsPat pat
go1 (NPat _ _ _) = False
go1 (NPlusKPat _ _ _ _) = False
go1 (NPat _ _ _) = False
go1 (NPlusKPat _ _ _ _) = False
- go1 (TypePat _) = panic "isIrrefutableHsPat: type pattern"
+ go1 (QuasiQuotePat {}) = urk pat -- Gotten rid of by renamer, before
+ -- isIrrefutablePat is called
+ go1 (TypePat {}) = urk pat
+
+ urk pat = pprPanic "isIrrefutableHsPat:" (ppr pat)
\end{code}
\end{code}