diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2016-05-25 00:09:34 +0200 |
---|---|---|
committer | Alan Zimmerman <alan.zimm@gmail.com> | 2016-06-06 20:04:43 +0200 |
commit | 306ecad591951521ac3f5888ca8be85bf749d271 (patch) | |
tree | 1f6d154698f022b76042b1b796ca0ed959a2b201 /compiler/hsSyn/HsPat.hs | |
parent | 1937ef1c506b538f0f93cd290fa4a42fc85ab769 (diff) | |
download | haskell-wip/T12105.tar.gz |
Merge MatchFixity and HsMatchContextwip/T12105
Summary:
MatchFixity was introduced to facilitate use of API Annotations.
HsMatchContext does the same thing with more detail, but is chased
through all over the place to provide context when processing a Match.
Since we already have MatchFixity in the Match, it may as well provide
the full context.
updates submodule haddock
Test Plan: ./validate
Reviewers: austin, goldfire, bgamari
Subscribers: thomie, mpickering
Differential Revision: https://phabricator.haskell.org/D2271
GHC Trac Issues: #12105
Diffstat (limited to 'compiler/hsSyn/HsPat.hs')
-rw-r--r-- | compiler/hsSyn/HsPat.hs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs index c168def337..ef667a1d71 100644 --- a/compiler/hsSyn/HsPat.hs +++ b/compiler/hsSyn/HsPat.hs @@ -43,7 +43,7 @@ import {-# SOURCE #-} HsExpr (SyntaxExpr, LHsExpr, HsSplice, pprLExpr -- friends: import HsBinds import HsLit -import PlaceHolder -- ( PostRn,PostTc,DataId ) +import PlaceHolder import HsTypes import TcEvidence import BasicTypes @@ -365,7 +365,7 @@ hsRecUpdFieldOcc = fmap unambiguousFieldOcc . hsRecFieldLbl ************************************************************************ -} -instance (OutputableBndr name) => Outputable (Pat name) where +instance (OutputableBndrId name) => Outputable (Pat name) where ppr = pprPat pprPatBndr :: OutputableBndr name => name -> SDoc @@ -377,10 +377,10 @@ pprPatBndr var -- Print with type info if -dppr-debug is on else pprPrefixOcc var -pprParendLPat :: (OutputableBndr name) => LPat name -> SDoc +pprParendLPat :: (OutputableBndrId name) => LPat name -> SDoc pprParendLPat (L _ p) = pprParendPat p -pprParendPat :: (OutputableBndr name) => Pat name -> SDoc +pprParendPat :: (OutputableBndrId name) => Pat name -> SDoc pprParendPat p = sdocWithDynFlags $ \ dflags -> if need_parens dflags p then parens (pprPat p) @@ -394,7 +394,7 @@ pprParendPat p = sdocWithDynFlags $ \ dflags -> -- But otherwise the CoPat is discarded, so it -- is the pattern inside that matters. Sigh. -pprPat :: (OutputableBndr name) => Pat name -> SDoc +pprPat :: (OutputableBndrId name) => Pat name -> SDoc pprPat (VarPat (L _ var)) = pprPatBndr var pprPat (WildPat _) = char '_' pprPat (LazyPat pat) = char '~' <> pprParendLPat pat @@ -430,11 +430,12 @@ pprPat (ConPatOut { pat_con = con, pat_tvs = tvs, pat_dicts = dicts, else pprUserCon (unLoc con) details -pprUserCon :: (OutputableBndr con, OutputableBndr id) => con -> HsConPatDetails id -> SDoc +pprUserCon :: (OutputableBndr con, OutputableBndrId id) + => con -> HsConPatDetails id -> SDoc pprUserCon c (InfixCon p1 p2) = ppr p1 <+> pprInfixOcc c <+> ppr p2 pprUserCon c details = pprPrefixOcc c <+> pprConArgs details -pprConArgs :: OutputableBndr id => HsConPatDetails id -> SDoc +pprConArgs :: (OutputableBndrId id) => HsConPatDetails id -> SDoc pprConArgs (PrefixCon pats) = sep (map pprParendLPat pats) pprConArgs (InfixCon p1 p2) = sep [pprParendLPat p1, pprParendLPat p2] pprConArgs (RecCon rpats) = ppr rpats @@ -546,7 +547,7 @@ looksLazyLPat (L _ (VarPat {})) = False looksLazyLPat (L _ (WildPat {})) = False looksLazyLPat _ = True -isIrrefutableHsPat :: OutputableBndr id => LPat id -> Bool +isIrrefutableHsPat :: (OutputableBndrId 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 |