{-# LANGUAGE CPP #-}
module TcOrigin (
UserTypeCtxt(..), pprUserTypeCtxt, isSigMaybe,
SkolemInfo(..), pprSigSkolInfo, pprSkolInfo,
CtOrigin(..), exprCtOrigin, lexprCtOrigin, matchesCtOrigin, grhssCtOrigin,
isVisibleOrigin, toInvisibleOrigin,
pprCtOrigin, isGivenOrigin
) where
#include "HsVersions.h"
import GhcPrelude
import TcType
import GHC.Hs
import Id
import DataCon
import ConLike
import TyCon
import InstEnv
import PatSyn
import Module
import Name
import RdrName
import qualified GHC.LanguageExtensions as LangExt
import DynFlags
import SrcLoc
import FastString
import Outputable
import BasicTypes
data UserTypeCtxt
= FunSigCtxt
Name
Bool
| InfSigCtxt Name
| ExprSigCtxt
| KindSigCtxt
| StandaloneKindSigCtxt
Name
| TypeAppCtxt
| ConArgCtxt Name
| TySynCtxt Name
| PatSynCtxt Name
| PatSigCtxt
| RuleSigCtxt Name
| ResSigCtxt
| ForSigCtxt Name
| DefaultDeclCtxt
| InstDeclCtxt Bool
| SpecInstCtxt
| ThBrackCtxt
| GenSigCtxt
| GhciCtxt Bool
| ClassSCCtxt Name
| SigmaCtxt
| DataTyCtxt Name
| DerivClauseCtxt
| TyVarBndrKindCtxt Name
| DataKindCtxt Name
| TySynKindCtxt Name
| TyFamResKindCtxt Name
pprUserTypeCtxt :: UserTypeCtxt -> SDoc
pprUserTypeCtxt :: UserTypeCtxt -> SDoc
pprUserTypeCtxt (FunSigCtxt Name
n Bool
_) = String -> SDoc
text String
"the type signature for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt (InfSigCtxt Name
n) = String -> SDoc
text String
"the inferred type for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt (RuleSigCtxt Name
n) = String -> SDoc
text String
"a RULE for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt UserTypeCtxt
ExprSigCtxt = String -> SDoc
text String
"an expression type signature"
pprUserTypeCtxt UserTypeCtxt
KindSigCtxt = String -> SDoc
text String
"a kind signature"
pprUserTypeCtxt (StandaloneKindSigCtxt Name
n) = String -> SDoc
text String
"a standalone kind signature for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt UserTypeCtxt
TypeAppCtxt = String -> SDoc
text String
"a type argument"
pprUserTypeCtxt (ConArgCtxt Name
c) = String -> SDoc
text String
"the type of the constructor" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
c)
pprUserTypeCtxt (TySynCtxt Name
c) = String -> SDoc
text String
"the RHS of the type synonym" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
c)
pprUserTypeCtxt UserTypeCtxt
ThBrackCtxt = String -> SDoc
text String
"a Template Haskell quotation [t|...|]"
pprUserTypeCtxt UserTypeCtxt
PatSigCtxt = String -> SDoc
text String
"a pattern type signature"
pprUserTypeCtxt UserTypeCtxt
ResSigCtxt = String -> SDoc
text String
"a result type signature"
pprUserTypeCtxt (ForSigCtxt Name
n) = String -> SDoc
text String
"the foreign declaration for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt UserTypeCtxt
DefaultDeclCtxt = String -> SDoc
text String
"a type in a `default' declaration"
pprUserTypeCtxt (InstDeclCtxt Bool
False) = String -> SDoc
text String
"an instance declaration"
pprUserTypeCtxt (InstDeclCtxt Bool
True) = String -> SDoc
text String
"a stand-alone deriving instance declaration"
pprUserTypeCtxt UserTypeCtxt
SpecInstCtxt = String -> SDoc
text String
"a SPECIALISE instance pragma"
pprUserTypeCtxt UserTypeCtxt
GenSigCtxt = String -> SDoc
text String
"a type expected by the context"
pprUserTypeCtxt (GhciCtxt {}) = String -> SDoc
text String
"a type in a GHCi command"
pprUserTypeCtxt (ClassSCCtxt Name
c) = String -> SDoc
text String
"the super-classes of class" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
c)
pprUserTypeCtxt UserTypeCtxt
SigmaCtxt = String -> SDoc
text String
"the context of a polymorphic type"
pprUserTypeCtxt (DataTyCtxt Name
tc) = String -> SDoc
text String
"the context of the data type declaration for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
tc)
pprUserTypeCtxt (PatSynCtxt Name
n) = String -> SDoc
text String
"the signature for pattern synonym" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt (UserTypeCtxt
DerivClauseCtxt) = String -> SDoc
text String
"a `deriving' clause"
pprUserTypeCtxt (TyVarBndrKindCtxt Name
n) = String -> SDoc
text String
"the kind annotation on the type variable" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt (DataKindCtxt Name
n) = String -> SDoc
text String
"the kind annotation on the declaration for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt (TySynKindCtxt Name
n) = String -> SDoc
text String
"the kind annotation on the declaration for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
pprUserTypeCtxt (TyFamResKindCtxt Name
n) = String -> SDoc
text String
"the result kind for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
isSigMaybe :: UserTypeCtxt -> Maybe Name
isSigMaybe :: UserTypeCtxt -> Maybe Name
isSigMaybe (FunSigCtxt Name
n Bool
_) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
n
isSigMaybe (ConArgCtxt Name
n) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
n
isSigMaybe (ForSigCtxt Name
n) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
n
isSigMaybe (PatSynCtxt Name
n) = Name -> Maybe Name
forall a. a -> Maybe a
Just Name
n
isSigMaybe UserTypeCtxt
_ = Maybe Name
forall a. Maybe a
Nothing
data SkolemInfo
= SigSkol
UserTypeCtxt
TcType
[(Name,TcTyVar)]
| SigTypeSkol UserTypeCtxt
| ForAllSkol SDoc
| DerivSkol Type
| InstSkol
| InstSC TypeSize
| FamInstSkol
| PatSkol
ConLike
(HsMatchContext Name)
| ArrowSkol
| IPSkol [HsIPName]
| RuleSkol RuleName
| InferSkol [(Name,TcType)]
| BracketSkol
| UnifyForAllSkol
TcType
| TyConSkol TyConFlavour Name
| DataConSkol Name
| ReifySkol
| QuantCtxtSkol
| UnkSkol
instance Outputable SkolemInfo where
ppr :: SkolemInfo -> SDoc
ppr = SkolemInfo -> SDoc
pprSkolInfo
pprSkolInfo :: SkolemInfo -> SDoc
pprSkolInfo :: SkolemInfo -> SDoc
pprSkolInfo (SigSkol UserTypeCtxt
cx TcType
ty [(Name, TcTyVar)]
_) = UserTypeCtxt -> TcType -> SDoc
pprSigSkolInfo UserTypeCtxt
cx TcType
ty
pprSkolInfo (SigTypeSkol UserTypeCtxt
cx) = UserTypeCtxt -> SDoc
pprUserTypeCtxt UserTypeCtxt
cx
pprSkolInfo (ForAllSkol SDoc
doc) = SDoc -> SDoc
quotes SDoc
doc
pprSkolInfo (IPSkol [HsIPName]
ips) = String -> SDoc
text String
"the implicit-parameter binding" SDoc -> SDoc -> SDoc
<> [HsIPName] -> SDoc
forall a. [a] -> SDoc
plural [HsIPName]
ips SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"for"
SDoc -> SDoc -> SDoc
<+> (HsIPName -> SDoc) -> [HsIPName] -> SDoc
forall a. (a -> SDoc) -> [a] -> SDoc
pprWithCommas HsIPName -> SDoc
forall a. Outputable a => a -> SDoc
ppr [HsIPName]
ips
pprSkolInfo (DerivSkol TcType
pred) = String -> SDoc
text String
"the deriving clause for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
pred)
pprSkolInfo SkolemInfo
InstSkol = String -> SDoc
text String
"the instance declaration"
pprSkolInfo (InstSC TypeSize
n) = String -> SDoc
text String
"the instance declaration" SDoc -> SDoc -> SDoc
<> SDoc -> SDoc
whenPprDebug (SDoc -> SDoc
parens (TypeSize -> SDoc
forall a. Outputable a => a -> SDoc
ppr TypeSize
n))
pprSkolInfo SkolemInfo
FamInstSkol = String -> SDoc
text String
"a family instance declaration"
pprSkolInfo SkolemInfo
BracketSkol = String -> SDoc
text String
"a Template Haskell bracket"
pprSkolInfo (RuleSkol RuleName
name) = String -> SDoc
text String
"the RULE" SDoc -> SDoc -> SDoc
<+> RuleName -> SDoc
pprRuleName RuleName
name
pprSkolInfo SkolemInfo
ArrowSkol = String -> SDoc
text String
"an arrow form"
pprSkolInfo (PatSkol ConLike
cl HsMatchContext Name
mc) = [SDoc] -> SDoc
sep [ ConLike -> SDoc
pprPatSkolInfo ConLike
cl
, String -> SDoc
text String
"in" SDoc -> SDoc -> SDoc
<+> HsMatchContext Name -> SDoc
forall id.
(Outputable (NameOrRdrName id), Outputable id) =>
HsMatchContext id -> SDoc
pprMatchContext HsMatchContext Name
mc ]
pprSkolInfo (InferSkol [(Name, TcType)]
ids) = SDoc -> Int -> SDoc -> SDoc
hang (String -> SDoc
text String
"the inferred type" SDoc -> SDoc -> SDoc
<> [(Name, TcType)] -> SDoc
forall a. [a] -> SDoc
plural [(Name, TcType)]
ids SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"of")
Int
2 ([SDoc] -> SDoc
vcat [ Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name SDoc -> SDoc -> SDoc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
ty
| (Name
name,TcType
ty) <- [(Name, TcType)]
ids ])
pprSkolInfo (UnifyForAllSkol TcType
ty) = String -> SDoc
text String
"the type" SDoc -> SDoc -> SDoc
<+> TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
ty
pprSkolInfo (TyConSkol TyConFlavour
flav Name
name) = String -> SDoc
text String
"the" SDoc -> SDoc -> SDoc
<+> TyConFlavour -> SDoc
forall a. Outputable a => a -> SDoc
ppr TyConFlavour
flav SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"declaration for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name)
pprSkolInfo (DataConSkol Name
name)= String -> SDoc
text String
"the data constructor" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name)
pprSkolInfo SkolemInfo
ReifySkol = String -> SDoc
text String
"the type being reified"
pprSkolInfo (QuantCtxtSkol {}) = String -> SDoc
text String
"a quantified context"
pprSkolInfo SkolemInfo
UnkSkol = WARN( True, text "pprSkolInfo: UnkSkol" ) text "UnkSkol"
pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
pprSigSkolInfo UserTypeCtxt
ctxt TcType
ty
= case UserTypeCtxt
ctxt of
FunSigCtxt Name
f Bool
_ -> [SDoc] -> SDoc
vcat [ String -> SDoc
text String
"the type signature for:"
, Int -> SDoc -> SDoc
nest Int
2 (Name -> SDoc
forall a. OutputableBndr a => a -> SDoc
pprPrefixOcc Name
f SDoc -> SDoc -> SDoc
<+> SDoc
dcolon SDoc -> SDoc -> SDoc
<+> TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
ty) ]
PatSynCtxt {} -> UserTypeCtxt -> SDoc
pprUserTypeCtxt UserTypeCtxt
ctxt
UserTypeCtxt
_ -> [SDoc] -> SDoc
vcat [ UserTypeCtxt -> SDoc
pprUserTypeCtxt UserTypeCtxt
ctxt SDoc -> SDoc -> SDoc
<> SDoc
colon
, Int -> SDoc -> SDoc
nest Int
2 (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
ty) ]
pprPatSkolInfo :: ConLike -> SDoc
pprPatSkolInfo :: ConLike -> SDoc
pprPatSkolInfo (RealDataCon DataCon
dc)
= [SDoc] -> SDoc
sep [ String -> SDoc
text String
"a pattern with constructor:"
, Int -> SDoc -> SDoc
nest Int
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
dc SDoc -> SDoc -> SDoc
<+> SDoc
dcolon
SDoc -> SDoc -> SDoc
<+> TcType -> SDoc
pprType (DataCon -> TcType
dataConUserType DataCon
dc) SDoc -> SDoc -> SDoc
<> SDoc
comma ]
pprPatSkolInfo (PatSynCon PatSyn
ps)
= [SDoc] -> SDoc
sep [ String -> SDoc
text String
"a pattern with pattern synonym:"
, Int -> SDoc -> SDoc
nest Int
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ PatSyn -> SDoc
forall a. Outputable a => a -> SDoc
ppr PatSyn
ps SDoc -> SDoc -> SDoc
<+> SDoc
dcolon
SDoc -> SDoc -> SDoc
<+> PatSyn -> SDoc
pprPatSynType PatSyn
ps SDoc -> SDoc -> SDoc
<> SDoc
comma ]
data CtOrigin
= GivenOrigin SkolemInfo
| OccurrenceOf Name
| OccurrenceOfRecSel RdrName
| AppOrigin
| SpecPragOrigin UserTypeCtxt
| TypeEqOrigin { CtOrigin -> TcType
uo_actual :: TcType
, CtOrigin -> TcType
uo_expected :: TcType
, CtOrigin -> Maybe SDoc
uo_thing :: Maybe SDoc
, CtOrigin -> Bool
uo_visible :: Bool
}
| KindEqOrigin
TcType (Maybe TcType)
CtOrigin
(Maybe TypeOrKind)
| IPOccOrigin HsIPName
| OverLabelOrigin FastString
| LiteralOrigin (HsOverLit GhcRn)
| NegateOrigin
| ArithSeqOrigin (ArithSeqInfo GhcRn)
| AssocFamPatOrigin
| SectionOrigin
| TupleOrigin
| ExprSigOrigin
| PatSigOrigin
| PatOrigin
| ProvCtxtOrigin
(PatSynBind GhcRn GhcRn)
| RecordUpdOrigin
| ViewPatOrigin
| ScOrigin TypeSize
| DerivClauseOrigin
| DerivOriginDC DataCon Int Bool
| DerivOriginCoerce Id Type Type Bool
| StandAloneDerivOrigin
| DefaultOrigin
| DoOrigin
| DoPatOrigin (LPat GhcRn)
| MCompOrigin
| MCompPatOrigin (LPat GhcRn)
| IfOrigin
| ProcOrigin
| AnnOrigin
| FunDepOrigin1
PredType CtOrigin RealSrcSpan
PredType CtOrigin RealSrcSpan
| FunDepOrigin2
PredType CtOrigin
PredType SrcSpan
| HoleOrigin
| UnboundOccurrenceOf OccName
| ListOrigin
| StaticOrigin
| FailablePattern (LPat GhcTcId)
| Shouldn'tHappenOrigin String
| InstProvidedOrigin Module ClsInst
isVisibleOrigin :: CtOrigin -> Bool
isVisibleOrigin :: CtOrigin -> Bool
isVisibleOrigin (TypeEqOrigin { uo_visible :: CtOrigin -> Bool
uo_visible = Bool
vis }) = Bool
vis
isVisibleOrigin (KindEqOrigin TcType
_ Maybe TcType
_ CtOrigin
sub_orig Maybe TypeOrKind
_) = CtOrigin -> Bool
isVisibleOrigin CtOrigin
sub_orig
isVisibleOrigin CtOrigin
_ = Bool
True
toInvisibleOrigin :: CtOrigin -> CtOrigin
toInvisibleOrigin :: CtOrigin -> CtOrigin
toInvisibleOrigin orig :: CtOrigin
orig@(TypeEqOrigin {}) = CtOrigin
orig { uo_visible :: Bool
uo_visible = Bool
False }
toInvisibleOrigin CtOrigin
orig = CtOrigin
orig
isGivenOrigin :: CtOrigin -> Bool
isGivenOrigin :: CtOrigin -> Bool
isGivenOrigin (GivenOrigin {}) = Bool
True
isGivenOrigin (FunDepOrigin1 TcType
_ CtOrigin
o1 RealSrcSpan
_ TcType
_ CtOrigin
o2 RealSrcSpan
_) = CtOrigin -> Bool
isGivenOrigin CtOrigin
o1 Bool -> Bool -> Bool
&& CtOrigin -> Bool
isGivenOrigin CtOrigin
o2
isGivenOrigin (FunDepOrigin2 TcType
_ CtOrigin
o1 TcType
_ SrcSpan
_) = CtOrigin -> Bool
isGivenOrigin CtOrigin
o1
isGivenOrigin CtOrigin
_ = Bool
False
instance Outputable CtOrigin where
ppr :: CtOrigin -> SDoc
ppr = CtOrigin -> SDoc
pprCtOrigin
ctoHerald :: SDoc
ctoHerald :: SDoc
ctoHerald = String -> SDoc
text String
"arising from"
lexprCtOrigin :: LHsExpr GhcRn -> CtOrigin
lexprCtOrigin :: LHsExpr GhcRn -> CtOrigin
lexprCtOrigin (L SrcSpan
_ HsExpr GhcRn
e) = HsExpr GhcRn -> CtOrigin
exprCtOrigin HsExpr GhcRn
e
exprCtOrigin :: HsExpr GhcRn -> CtOrigin
exprCtOrigin :: HsExpr GhcRn -> CtOrigin
exprCtOrigin (HsVar XVar GhcRn
_ (L SrcSpan
_ IdP GhcRn
name)) = Name -> CtOrigin
OccurrenceOf Name
IdP GhcRn
name
exprCtOrigin (HsUnboundVar XUnboundVar GhcRn
_ UnboundVar
uv) = OccName -> CtOrigin
UnboundOccurrenceOf (UnboundVar -> OccName
unboundVarOcc UnboundVar
uv)
exprCtOrigin (HsConLikeOut {}) = String -> CtOrigin
forall a. String -> a
panic String
"exprCtOrigin HsConLikeOut"
exprCtOrigin (HsRecFld XRecFld GhcRn
_ AmbiguousFieldOcc GhcRn
f) = RdrName -> CtOrigin
OccurrenceOfRecSel (AmbiguousFieldOcc GhcRn -> RdrName
forall (p :: Pass). AmbiguousFieldOcc (GhcPass p) -> RdrName
rdrNameAmbiguousFieldOcc AmbiguousFieldOcc GhcRn
f)
exprCtOrigin (HsOverLabel XOverLabel GhcRn
_ Maybe (IdP GhcRn)
_ RuleName
l) = RuleName -> CtOrigin
OverLabelOrigin RuleName
l
exprCtOrigin (HsIPVar XIPVar GhcRn
_ HsIPName
ip) = HsIPName -> CtOrigin
IPOccOrigin HsIPName
ip
exprCtOrigin (HsOverLit XOverLitE GhcRn
_ HsOverLit GhcRn
lit) = HsOverLit GhcRn -> CtOrigin
LiteralOrigin HsOverLit GhcRn
lit
exprCtOrigin (HsLit {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"concrete literal"
exprCtOrigin (HsLam XLam GhcRn
_ MatchGroup GhcRn (LHsExpr GhcRn)
matches) = MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin
matchesCtOrigin MatchGroup GhcRn (LHsExpr GhcRn)
matches
exprCtOrigin (HsLamCase XLamCase GhcRn
_ MatchGroup GhcRn (LHsExpr GhcRn)
ms) = MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin
matchesCtOrigin MatchGroup GhcRn (LHsExpr GhcRn)
ms
exprCtOrigin (HsApp XApp GhcRn
_ LHsExpr GhcRn
e1 LHsExpr GhcRn
_) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e1
exprCtOrigin (HsAppType XAppTypeE GhcRn
_ LHsExpr GhcRn
e1 LHsWcType (NoGhcTc GhcRn)
_) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e1
exprCtOrigin (OpApp XOpApp GhcRn
_ LHsExpr GhcRn
_ LHsExpr GhcRn
op LHsExpr GhcRn
_) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
op
exprCtOrigin (NegApp XNegApp GhcRn
_ LHsExpr GhcRn
e SyntaxExpr GhcRn
_) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (HsPar XPar GhcRn
_ LHsExpr GhcRn
e) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (SectionL XSectionL GhcRn
_ LHsExpr GhcRn
_ LHsExpr GhcRn
_) = CtOrigin
SectionOrigin
exprCtOrigin (SectionR XSectionR GhcRn
_ LHsExpr GhcRn
_ LHsExpr GhcRn
_) = CtOrigin
SectionOrigin
exprCtOrigin (ExplicitTuple {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"explicit tuple"
exprCtOrigin ExplicitSum{} = String -> CtOrigin
Shouldn'tHappenOrigin String
"explicit sum"
exprCtOrigin (HsCase XCase GhcRn
_ LHsExpr GhcRn
_ MatchGroup GhcRn (LHsExpr GhcRn)
matches) = MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin
matchesCtOrigin MatchGroup GhcRn (LHsExpr GhcRn)
matches
exprCtOrigin (HsIf XIf GhcRn
_ (Just SyntaxExpr GhcRn
syn) LHsExpr GhcRn
_ LHsExpr GhcRn
_ LHsExpr GhcRn
_) = HsExpr GhcRn -> CtOrigin
exprCtOrigin (SyntaxExpr GhcRn -> HsExpr GhcRn
forall p. SyntaxExpr p -> HsExpr p
syn_expr SyntaxExpr GhcRn
syn)
exprCtOrigin (HsIf {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"if expression"
exprCtOrigin (HsMultiIf XMultiIf GhcRn
_ [LGRHS GhcRn (LHsExpr GhcRn)]
rhs) = [LGRHS GhcRn (LHsExpr GhcRn)] -> CtOrigin
lGRHSCtOrigin [LGRHS GhcRn (LHsExpr GhcRn)]
rhs
exprCtOrigin (HsLet XLet GhcRn
_ LHsLocalBinds GhcRn
_ LHsExpr GhcRn
e) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (HsDo {}) = CtOrigin
DoOrigin
exprCtOrigin (ExplicitList {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"list"
exprCtOrigin (RecordCon {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"record construction"
exprCtOrigin (RecordUpd {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"record update"
exprCtOrigin (ExprWithTySig {}) = CtOrigin
ExprSigOrigin
exprCtOrigin (ArithSeq {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"arithmetic sequence"
exprCtOrigin (HsSCC XSCC GhcRn
_ SourceText
_ StringLiteral
_ LHsExpr GhcRn
e) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (HsCoreAnn XCoreAnn GhcRn
_ SourceText
_ StringLiteral
_ LHsExpr GhcRn
e) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (HsBracket {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"TH bracket"
exprCtOrigin (HsRnBracketOut {})= String -> CtOrigin
Shouldn'tHappenOrigin String
"HsRnBracketOut"
exprCtOrigin (HsTcBracketOut {})= String -> CtOrigin
forall a. String -> a
panic String
"exprCtOrigin HsTcBracketOut"
exprCtOrigin (HsSpliceE {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"TH splice"
exprCtOrigin (HsProc {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"proc"
exprCtOrigin (HsStatic {}) = String -> CtOrigin
Shouldn'tHappenOrigin String
"static expression"
exprCtOrigin (HsTick XTick GhcRn
_ Tickish (IdP GhcRn)
_ LHsExpr GhcRn
e) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (HsBinTick XBinTick GhcRn
_ Int
_ Int
_ LHsExpr GhcRn
e) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (HsTickPragma XTickPragma GhcRn
_ SourceText
_ (StringLiteral, (Int, Int), (Int, Int))
_ ((SourceText, SourceText), (SourceText, SourceText))
_ LHsExpr GhcRn
e) = LHsExpr GhcRn -> CtOrigin
lexprCtOrigin LHsExpr GhcRn
e
exprCtOrigin (HsWrap {}) = String -> CtOrigin
forall a. String -> a
panic String
"exprCtOrigin HsWrap"
exprCtOrigin (XExpr XXExpr GhcRn
nec) = NoExtCon -> CtOrigin
forall a. NoExtCon -> a
noExtCon XXExpr GhcRn
NoExtCon
nec
matchesCtOrigin :: MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin
matchesCtOrigin :: MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin
matchesCtOrigin (MG { mg_alts :: forall p body. MatchGroup p body -> Located [LMatch p body]
mg_alts = Located [LMatch GhcRn (LHsExpr GhcRn)]
alts })
| L SrcSpan
_ [L SrcSpan
_ Match GhcRn (LHsExpr GhcRn)
match] <- Located [LMatch GhcRn (LHsExpr GhcRn)]
alts
, Match { m_grhss :: forall p body. Match p body -> GRHSs p body
m_grhss = GRHSs GhcRn (LHsExpr GhcRn)
grhss } <- Match GhcRn (LHsExpr GhcRn)
match
= GRHSs GhcRn (LHsExpr GhcRn) -> CtOrigin
grhssCtOrigin GRHSs GhcRn (LHsExpr GhcRn)
grhss
| Bool
otherwise
= String -> CtOrigin
Shouldn'tHappenOrigin String
"multi-way match"
matchesCtOrigin (XMatchGroup XXMatchGroup GhcRn (LHsExpr GhcRn)
nec) = NoExtCon -> CtOrigin
forall a. NoExtCon -> a
noExtCon XXMatchGroup GhcRn (LHsExpr GhcRn)
NoExtCon
nec
grhssCtOrigin :: GRHSs GhcRn (LHsExpr GhcRn) -> CtOrigin
grhssCtOrigin :: GRHSs GhcRn (LHsExpr GhcRn) -> CtOrigin
grhssCtOrigin (GRHSs { grhssGRHSs :: forall p body. GRHSs p body -> [LGRHS p body]
grhssGRHSs = [LGRHS GhcRn (LHsExpr GhcRn)]
lgrhss }) = [LGRHS GhcRn (LHsExpr GhcRn)] -> CtOrigin
lGRHSCtOrigin [LGRHS GhcRn (LHsExpr GhcRn)]
lgrhss
grhssCtOrigin (XGRHSs XXGRHSs GhcRn (LHsExpr GhcRn)
nec) = NoExtCon -> CtOrigin
forall a. NoExtCon -> a
noExtCon XXGRHSs GhcRn (LHsExpr GhcRn)
NoExtCon
nec
lGRHSCtOrigin :: [LGRHS GhcRn (LHsExpr GhcRn)] -> CtOrigin
lGRHSCtOrigin :: [LGRHS GhcRn (LHsExpr GhcRn)] -> CtOrigin
lGRHSCtOrigin [L SrcSpan
_ (GRHS XCGRHS GhcRn (LHsExpr GhcRn)
_ [GuardLStmt GhcRn]
_ (L SrcSpan
_ HsExpr GhcRn
e))] = HsExpr GhcRn -> CtOrigin
exprCtOrigin HsExpr GhcRn
e
lGRHSCtOrigin [L SrcSpan
_ (XGRHS XXGRHS GhcRn (LHsExpr GhcRn)
nec)] = NoExtCon -> CtOrigin
forall a. NoExtCon -> a
noExtCon XXGRHS GhcRn (LHsExpr GhcRn)
NoExtCon
nec
lGRHSCtOrigin [LGRHS GhcRn (LHsExpr GhcRn)]
_ = String -> CtOrigin
Shouldn'tHappenOrigin String
"multi-way GRHS"
pprCtOrigin :: CtOrigin -> SDoc
pprCtOrigin :: CtOrigin -> SDoc
pprCtOrigin (GivenOrigin SkolemInfo
sk) = SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> SkolemInfo -> SDoc
forall a. Outputable a => a -> SDoc
ppr SkolemInfo
sk
pprCtOrigin (SpecPragOrigin UserTypeCtxt
ctxt)
= case UserTypeCtxt
ctxt of
FunSigCtxt Name
n Bool
_ -> String -> SDoc
text String
"for" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
n)
UserTypeCtxt
SpecInstCtxt -> String -> SDoc
text String
"a SPECIALISE INSTANCE pragma"
UserTypeCtxt
_ -> String -> SDoc
text String
"a SPECIALISE pragma"
pprCtOrigin (FunDepOrigin1 TcType
pred1 CtOrigin
orig1 RealSrcSpan
loc1 TcType
pred2 CtOrigin
orig2 RealSrcSpan
loc2)
= SDoc -> Int -> SDoc -> SDoc
hang (SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"a functional dependency between constraints:")
Int
2 ([SDoc] -> SDoc
vcat [ SDoc -> Int -> SDoc -> SDoc
hang (SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
pred1)) Int
2 (CtOrigin -> SDoc
pprCtOrigin CtOrigin
orig1 SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"at" SDoc -> SDoc -> SDoc
<+> RealSrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr RealSrcSpan
loc1)
, SDoc -> Int -> SDoc -> SDoc
hang (SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
pred2)) Int
2 (CtOrigin -> SDoc
pprCtOrigin CtOrigin
orig2 SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"at" SDoc -> SDoc -> SDoc
<+> RealSrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr RealSrcSpan
loc2) ])
pprCtOrigin (FunDepOrigin2 TcType
pred1 CtOrigin
orig1 TcType
pred2 SrcSpan
loc2)
= SDoc -> Int -> SDoc -> SDoc
hang (SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"a functional dependency between:")
Int
2 ([SDoc] -> SDoc
vcat [ SDoc -> Int -> SDoc -> SDoc
hang (String -> SDoc
text String
"constraint" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
pred1))
Int
2 (CtOrigin -> SDoc
pprCtOrigin CtOrigin
orig1 )
, SDoc -> Int -> SDoc -> SDoc
hang (String -> SDoc
text String
"instance" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
pred2))
Int
2 (String -> SDoc
text String
"at" SDoc -> SDoc -> SDoc
<+> SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr SrcSpan
loc2) ])
pprCtOrigin (KindEqOrigin TcType
t1 (Just TcType
t2) CtOrigin
_ Maybe TypeOrKind
_)
= SDoc -> Int -> SDoc -> SDoc
hang (SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"a kind equality arising from")
Int
2 ([SDoc] -> SDoc
sep [TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
t1, Char -> SDoc
char Char
'~', TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
t2])
pprCtOrigin CtOrigin
AssocFamPatOrigin
= String -> SDoc
text String
"when matching a family LHS with its class instance head"
pprCtOrigin (KindEqOrigin TcType
t1 Maybe TcType
Nothing CtOrigin
_ Maybe TypeOrKind
_)
= SDoc -> Int -> SDoc -> SDoc
hang (SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"a kind equality when matching")
Int
2 (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
t1)
pprCtOrigin (UnboundOccurrenceOf OccName
name)
= SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"an undeclared identifier" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (OccName -> SDoc
forall a. Outputable a => a -> SDoc
ppr OccName
name)
pprCtOrigin (DerivOriginDC DataCon
dc Int
n Bool
_)
= SDoc -> Int -> SDoc -> SDoc
hang (SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"the" SDoc -> SDoc -> SDoc
<+> Int -> SDoc
speakNth Int
n
SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"field of" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (DataCon -> SDoc
forall a. Outputable a => a -> SDoc
ppr DataCon
dc))
Int
2 (SDoc -> SDoc
parens (String -> SDoc
text String
"type" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
ty)))
where
ty :: TcType
ty = DataCon -> [TcType]
dataConOrigArgTys DataCon
dc [TcType] -> Int -> TcType
forall a. [a] -> Int -> a
!! (Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)
pprCtOrigin (DerivOriginCoerce TcTyVar
meth TcType
ty1 TcType
ty2 Bool
_)
= SDoc -> Int -> SDoc -> SDoc
hang (SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"the coercion of the method" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (TcTyVar -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcTyVar
meth))
Int
2 ([SDoc] -> SDoc
sep [ String -> SDoc
text String
"from type" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
ty1)
, Int -> SDoc -> SDoc
nest Int
2 (SDoc -> SDoc) -> SDoc -> SDoc
forall a b. (a -> b) -> a -> b
$ String -> SDoc
text String
"to type" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
ty2) ])
pprCtOrigin (DoPatOrigin LPat GhcRn
pat)
= SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"a do statement"
SDoc -> SDoc -> SDoc
$$
String -> SDoc
text String
"with the failable pattern" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Located (Pat GhcRn) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (Pat GhcRn)
LPat GhcRn
pat)
pprCtOrigin (MCompPatOrigin LPat GhcRn
pat)
= SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> [SDoc] -> SDoc
hsep [ String -> SDoc
text String
"the failable pattern"
, SDoc -> SDoc
quotes (Located (Pat GhcRn) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (Pat GhcRn)
LPat GhcRn
pat)
, String -> SDoc
text String
"in a statement in a monad comprehension" ]
pprCtOrigin (FailablePattern LPat GhcTcId
pat)
= SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"the failable pattern" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Located (Pat GhcTcId) -> SDoc
forall a. Outputable a => a -> SDoc
ppr Located (Pat GhcTcId)
LPat GhcTcId
pat)
SDoc -> SDoc -> SDoc
$$
String -> SDoc
text String
"(this will become an error in a future GHC release)"
pprCtOrigin (Shouldn'tHappenOrigin String
note)
= (DynFlags -> SDoc) -> SDoc
sdocWithDynFlags ((DynFlags -> SDoc) -> SDoc) -> (DynFlags -> SDoc) -> SDoc
forall a b. (a -> b) -> a -> b
$ \DynFlags
dflags ->
if Extension -> DynFlags -> Bool
xopt Extension
LangExt.ImpredicativeTypes DynFlags
dflags
then String -> SDoc
text String
"a situation created by impredicative types"
else
[SDoc] -> SDoc
vcat [ String -> SDoc
text String
"<< This should not appear in error messages. If you see this"
, String -> SDoc
text String
"in an error message, please report a bug mentioning" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (String -> SDoc
text String
note) SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"at"
, String -> SDoc
text String
"https://gitlab.haskell.org/ghc/ghc/wikis/report-a-bug >>" ]
pprCtOrigin (ProvCtxtOrigin PSB{ psb_id :: forall idL idR. PatSynBind idL idR -> Located (IdP idL)
psb_id = (L SrcSpan
_ IdP GhcRn
name) })
= SDoc -> Int -> SDoc -> SDoc
hang (SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> String -> SDoc
text String
"the \"provided\" constraints claimed by")
Int
2 (String -> SDoc
text String
"the signature of" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
IdP GhcRn
name))
pprCtOrigin (InstProvidedOrigin Module
mod ClsInst
cls_inst)
= [SDoc] -> SDoc
vcat [ String -> SDoc
text String
"arising when attempting to show that"
, ClsInst -> SDoc
forall a. Outputable a => a -> SDoc
ppr ClsInst
cls_inst
, String -> SDoc
text String
"is provided by" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (Module -> SDoc
forall a. Outputable a => a -> SDoc
ppr Module
mod)]
pprCtOrigin CtOrigin
simple_origin
= SDoc
ctoHerald SDoc -> SDoc -> SDoc
<+> CtOrigin -> SDoc
pprCtO CtOrigin
simple_origin
pprCtO :: CtOrigin -> SDoc
pprCtO :: CtOrigin -> SDoc
pprCtO (OccurrenceOf Name
name) = [SDoc] -> SDoc
hsep [String -> SDoc
text String
"a use of", SDoc -> SDoc
quotes (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr Name
name)]
pprCtO (OccurrenceOfRecSel RdrName
name) = [SDoc] -> SDoc
hsep [String -> SDoc
text String
"a use of", SDoc -> SDoc
quotes (RdrName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RdrName
name)]
pprCtO CtOrigin
AppOrigin = String -> SDoc
text String
"an application"
pprCtO (IPOccOrigin HsIPName
name) = [SDoc] -> SDoc
hsep [String -> SDoc
text String
"a use of implicit parameter", SDoc -> SDoc
quotes (HsIPName -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsIPName
name)]
pprCtO (OverLabelOrigin RuleName
l) = [SDoc] -> SDoc
hsep [String -> SDoc
text String
"the overloaded label"
,SDoc -> SDoc
quotes (Char -> SDoc
char Char
'#' SDoc -> SDoc -> SDoc
<> RuleName -> SDoc
forall a. Outputable a => a -> SDoc
ppr RuleName
l)]
pprCtO CtOrigin
RecordUpdOrigin = String -> SDoc
text String
"a record update"
pprCtO CtOrigin
ExprSigOrigin = String -> SDoc
text String
"an expression type signature"
pprCtO CtOrigin
PatSigOrigin = String -> SDoc
text String
"a pattern type signature"
pprCtO CtOrigin
PatOrigin = String -> SDoc
text String
"a pattern"
pprCtO CtOrigin
ViewPatOrigin = String -> SDoc
text String
"a view pattern"
pprCtO CtOrigin
IfOrigin = String -> SDoc
text String
"an if expression"
pprCtO (LiteralOrigin HsOverLit GhcRn
lit) = [SDoc] -> SDoc
hsep [String -> SDoc
text String
"the literal", SDoc -> SDoc
quotes (HsOverLit GhcRn -> SDoc
forall a. Outputable a => a -> SDoc
ppr HsOverLit GhcRn
lit)]
pprCtO (ArithSeqOrigin ArithSeqInfo GhcRn
seq) = [SDoc] -> SDoc
hsep [String -> SDoc
text String
"the arithmetic sequence", SDoc -> SDoc
quotes (ArithSeqInfo GhcRn -> SDoc
forall a. Outputable a => a -> SDoc
ppr ArithSeqInfo GhcRn
seq)]
pprCtO CtOrigin
SectionOrigin = String -> SDoc
text String
"an operator section"
pprCtO CtOrigin
AssocFamPatOrigin = String -> SDoc
text String
"the LHS of a famly instance"
pprCtO CtOrigin
TupleOrigin = String -> SDoc
text String
"a tuple"
pprCtO CtOrigin
NegateOrigin = String -> SDoc
text String
"a use of syntactic negation"
pprCtO (ScOrigin TypeSize
n) = String -> SDoc
text String
"the superclasses of an instance declaration"
SDoc -> SDoc -> SDoc
<> SDoc -> SDoc
whenPprDebug (SDoc -> SDoc
parens (TypeSize -> SDoc
forall a. Outputable a => a -> SDoc
ppr TypeSize
n))
pprCtO CtOrigin
DerivClauseOrigin = String -> SDoc
text String
"the 'deriving' clause of a data type declaration"
pprCtO CtOrigin
StandAloneDerivOrigin = String -> SDoc
text String
"a 'deriving' declaration"
pprCtO CtOrigin
DefaultOrigin = String -> SDoc
text String
"a 'default' declaration"
pprCtO CtOrigin
DoOrigin = String -> SDoc
text String
"a do statement"
pprCtO CtOrigin
MCompOrigin = String -> SDoc
text String
"a statement in a monad comprehension"
pprCtO CtOrigin
ProcOrigin = String -> SDoc
text String
"a proc expression"
pprCtO (TypeEqOrigin TcType
t1 TcType
t2 Maybe SDoc
_ Bool
_)= String -> SDoc
text String
"a type equality" SDoc -> SDoc -> SDoc
<+> [SDoc] -> SDoc
sep [TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
t1, Char -> SDoc
char Char
'~', TcType -> SDoc
forall a. Outputable a => a -> SDoc
ppr TcType
t2]
pprCtO CtOrigin
AnnOrigin = String -> SDoc
text String
"an annotation"
pprCtO CtOrigin
HoleOrigin = String -> SDoc
text String
"a use of" SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
quotes (String -> SDoc
text String
"_")
pprCtO CtOrigin
ListOrigin = String -> SDoc
text String
"an overloaded list"
pprCtO CtOrigin
StaticOrigin = String -> SDoc
text String
"a static form"
pprCtO CtOrigin
_ = String -> SDoc
forall a. String -> a
panic String
"pprCtOrigin"