GHC.Tc.Types.Origin

ghc-9.2.1: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Tc.Types.Origin

Description

Describes the provenance of types as they flow through the type-checker. The datatypes here are mainly used for error message generation.

Synopsis

- data UserTypeCtxt
  - = FunSigCtxt Name Bool
  - | InfSigCtxt Name
  - | ExprSigCtxt
  - | KindSigCtxt
  - | StandaloneKindSigCtxt Name
  - | TypeAppCtxt
  - | ConArgCtxt Name
  - | TySynCtxt Name
  - | PatSynCtxt Name
  - | PatSigCtxt
  - | RuleSigCtxt Name
  - | ForSigCtxt Name
  - | DefaultDeclCtxt
  - | InstDeclCtxt Bool
  - | SpecInstCtxt
  - | GenSigCtxt
  - | GhciCtxt Bool
  - | ClassSCCtxt Name
  - | SigmaCtxt
  - | DataTyCtxt Name
  - | DerivClauseCtxt
  - | TyVarBndrKindCtxt Name
  - | DataKindCtxt Name
  - | TySynKindCtxt Name
  - | TyFamResKindCtxt Name
- pprUserTypeCtxt :: UserTypeCtxt -> SDoc
- isSigMaybe :: UserTypeCtxt -> Maybe Name
- data SkolemInfo
  - = SigSkol UserTypeCtxt TcType [(Name, TcTyVar)]
  - | SigTypeSkol UserTypeCtxt
  - | ForAllSkol SDoc
  - | DerivSkol Type
  - | InstSkol
  - | InstSC TypeSize
  - | FamInstSkol
  - | PatSkol ConLike (HsMatchContext GhcRn)
  - | ArrowSkol
  - | IPSkol [HsIPName]
  - | RuleSkol RuleName
  - | InferSkol [(Name, TcType)]
  - | BracketSkol
  - | UnifyForAllSkol TcType
  - | TyConSkol TyConFlavour Name
  - | DataConSkol Name
  - | ReifySkol
  - | QuantCtxtSkol
  - | RuntimeUnkSkol
  - | UnkSkol
- pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc
- pprSkolInfo :: SkolemInfo -> SDoc
- data CtOrigin
  - = GivenOrigin SkolemInfo
  - | OccurrenceOf Name
  - | OccurrenceOfRecSel RdrName
  - | AppOrigin
  - | SpecPragOrigin UserTypeCtxt
  - | TypeEqOrigin {
    - uo_actual :: TcType
    - uo_expected :: TcType
    - uo_thing :: Maybe SDoc
    - uo_visible :: Bool
    }
  - | KindEqOrigin TcType TcType CtOrigin (Maybe TypeOrKind)
  - | IPOccOrigin HsIPName
  - | OverLabelOrigin FastString
  - | LiteralOrigin (HsOverLit GhcRn)
  - | NegateOrigin
  - | ArithSeqOrigin (ArithSeqInfo GhcRn)
  - | AssocFamPatOrigin
  - | SectionOrigin
  - | HasFieldOrigin FastString
  - | 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
  - | ExprHoleOrigin OccName
  - | TypeHoleOrigin OccName
  - | PatCheckOrigin
  - | ListOrigin
  - | BracketOrigin
  - | StaticOrigin
  - | Shouldn'tHappenOrigin String
  - | InstProvidedOrigin Module ClsInst
  - | NonLinearPatternOrigin
  - | UsageEnvironmentOf Name
  - | CycleBreakerOrigin CtOrigin
- exprCtOrigin :: HsExpr GhcRn -> CtOrigin
- lexprCtOrigin :: LHsExpr GhcRn -> CtOrigin
- matchesCtOrigin :: MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin
- grhssCtOrigin :: GRHSs GhcRn (LHsExpr GhcRn) -> CtOrigin
- isVisibleOrigin :: CtOrigin -> Bool
- toInvisibleOrigin :: CtOrigin -> CtOrigin
- pprCtOrigin :: CtOrigin -> SDoc
- isGivenOrigin :: CtOrigin -> Bool

# Documentation

data UserTypeCtxt Source #

UserTypeCtxt describes the origin of the polymorphic type in the places where we need an expression to have that type

Constructors

FunSigCtxt Name Bool |
InfSigCtxt Name |
ExprSigCtxt |
KindSigCtxt |
StandaloneKindSigCtxt Name |
TypeAppCtxt |
ConArgCtxt Name |
TySynCtxt Name |
PatSynCtxt Name |
PatSigCtxt |
RuleSigCtxt Name |
ForSigCtxt Name |
DefaultDeclCtxt |
InstDeclCtxt Bool |
SpecInstCtxt |
GenSigCtxt |
GhciCtxt Bool |
ClassSCCtxt Name |
SigmaCtxt |
DataTyCtxt Name |
DerivClauseCtxt |
TyVarBndrKindCtxt Name |
DataKindCtxt Name |
TySynKindCtxt Name |
TyFamResKindCtxt Name |

pprUserTypeCtxt :: UserTypeCtxt -> SDoc Source #

isSigMaybe :: UserTypeCtxt -> Maybe Name Source #

data SkolemInfo Source #

Constructors

SigSkol UserTypeCtxt TcType [(Name, TcTyVar)] |
SigTypeSkol UserTypeCtxt |
ForAllSkol SDoc |
DerivSkol Type |
InstSkol |
InstSC TypeSize |
FamInstSkol |
PatSkol ConLike (HsMatchContext GhcRn) |
ArrowSkol |
IPSkol [HsIPName] |
RuleSkol RuleName |
InferSkol [(Name, TcType)] |
BracketSkol |
UnifyForAllSkol TcType |
TyConSkol TyConFlavour Name |
DataConSkol Name |
ReifySkol |
QuantCtxtSkol |
RuntimeUnkSkol |
UnkSkol |

#### Instances

Instances details

Outputable SkolemInfo Source # |
Instance details Defined in GHC.Tc.Types.Origin Methods ppr :: SkolemInfo -> SDoc Source #

pprSigSkolInfo :: UserTypeCtxt -> TcType -> SDoc Source #

pprSkolInfo :: SkolemInfo -> SDoc Source #

data CtOrigin Source #

Constructors

GivenOrigin SkolemInfo |
OccurrenceOf Name |
OccurrenceOfRecSel RdrName |
AppOrigin |
SpecPragOrigin UserTypeCtxt |
TypeEqOrigin |
Fields uo_actual :: TcType uo_expected :: TcType uo_thing :: Maybe SDoc The thing that has type "actual" uo_visible :: Bool Is at least one of the three elements above visible? (Errors from the polymorphic subsumption check are considered visible.) Only used for prioritizing error messages.
KindEqOrigin TcType TcType CtOrigin (Maybe TypeOrKind) |
IPOccOrigin HsIPName |
OverLabelOrigin FastString |
LiteralOrigin (HsOverLit GhcRn) |
NegateOrigin |
ArithSeqOrigin (ArithSeqInfo GhcRn) |
AssocFamPatOrigin |
SectionOrigin |
HasFieldOrigin FastString |
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 |
ExprHoleOrigin OccName |
TypeHoleOrigin OccName |
PatCheckOrigin |
ListOrigin |
BracketOrigin |
StaticOrigin |
Shouldn'tHappenOrigin String |
InstProvidedOrigin Module ClsInst |
NonLinearPatternOrigin |
UsageEnvironmentOf Name |
CycleBreakerOrigin CtOrigin |

#### Instances

Instances details

Outputable CtOrigin Source # |
Instance details Defined in GHC.Tc.Types.Origin Methods ppr :: CtOrigin -> SDoc Source #

exprCtOrigin :: HsExpr GhcRn -> CtOrigin Source #

lexprCtOrigin :: LHsExpr GhcRn -> CtOrigin Source #

Extract a suitable CtOrigin from a HsExpr

matchesCtOrigin :: MatchGroup GhcRn (LHsExpr GhcRn) -> CtOrigin Source #

Extract a suitable CtOrigin from a MatchGroup

grhssCtOrigin :: GRHSs GhcRn (LHsExpr GhcRn) -> CtOrigin Source #

Extract a suitable CtOrigin from guarded RHSs

isVisibleOrigin :: CtOrigin -> Bool Source #

toInvisibleOrigin :: CtOrigin -> CtOrigin Source #

pprCtOrigin :: CtOrigin -> SDoc Source #

isGivenOrigin :: CtOrigin -> Bool Source #