compiler/typecheck¶
- compiler/typecheck/ClsInst.hs
- compiler/typecheck/FamInst.hs
- compiler/typecheck/FunDeps.hs
- compiler/typecheck/Inst.hs
- compiler/typecheck/TcArrows.hs
- compiler/typecheck/TcBackpack.hs
- compiler/typecheck/TcBinds.hs
- Note [Polymorphic recursion]
- Note [Implicit parameter untouchables]
- Note [Closed binder groups]
- Note [Instantiate sig with fresh variables]
- Note [Partial type signatures and generalisation]
- Note [Quantified variables in partial type signatures]
- Note [Validity of inferred types]
- Note [Impedance matching]
- Note [SPECIALISE pragmas]
- Note [Typechecking pattern bindings]
- compiler/typecheck/TcCanonical.hs
- Note [Canonicalization]
- Top-level canonicalization
- Note [The superclass story]
- Note [Superclass loops]
- Note [Eagerly expand given superclasses]
- Note [Why adding superclasses can help]
- Note [Danger of adding superclasses during solving]
- Note [Equality superclasses in quantified constraints]
- Note [Quantified constraints]
- Note [Solving a Wanted forall-constraint]
- Note [Solving a Given forall-constraint]
- Note [Canonicalising equalities]
- Note [FunTy and decomposing tycon applications]
- Note [Unsolved equalities]
- Note [Newtypes can blow the stack]
- Note [Eager reflexivity check]
- Note [Use canEqFailure in canDecomposableTyConApp]
- Note [Decomposing equality]
- Note [Decomposing newtypes at representational role]
- Note [Decomposing TyConApps]
- Note [Canonicalising type applications]
- Note [Make sure that insolubles are fully rewritten]
- Note [Do not decompose Given polytype equalities]
- Note [Combining insoluble constraints]
- Note [No top-level newtypes on RHS of representational equalities]
- Note [Occurs check error]
- Note [canCFunEqCan]
- Note [Canonical orientation for tyvar/tyvar equality constraints]
- Note [Equalities with incompatible kinds]
- Note [Type synonyms and canonicalization]
- Note [Rewriting with Refl]
- Note [unifyWanted and unifyDerived]
- compiler/typecheck/TcClassDcl.hs
- compiler/typecheck/TcDeriv.hs
- Note [Data decl contexts]
- Note [Newtype deriving]
- Note [Newtype deriving superclasses]
- Note [Unused constructors and deriving clauses]
- Note [Newtype deriving and unused constructors]
- Note [Staging of tcDeriving]
- Note [Why we don’t pass rep_tc into deriveTyData]
- Note [Avoid RebindableSyntax when deriving]
- Note [Flattening deriving clauses]
- Note [tc_args and tycon arity]
- Note [Unify kinds in deriving]
- Note [Unification of two kind variables in deriving]
- Note [Eta-reducing type synonyms]
- Note [Looking up family instances for deriving]
- Note [Deriving, type families, and partial applications]
- Note [Recursive newtypes]
- Note [Determining whether newtype-deriving is appropriate]
- Note [GND and associated type families]
- Note [Bindings for Generalised Newtype Deriving]
- Note [DeriveAnyClass and default family instances]
- Note [Deriving strategies]
- Note [Deriving instances for classes themselves]
- compiler/typecheck/TcDerivInfer.hs
- Note [Inferring the instance context]
- Note [Getting base classes]
- Note [Deriving and unboxed types]
- Note [Superclasses of derived instance]
- Note [Simplifying the instance context]
- Note [Deterministic simplifyInstanceContexts]
- Note [Overlap and deriving]
- Note [Gathering and simplifying constraints for DeriveAnyClass]
- Note [Error reporting for deriving clauses]
- Note [Exotic derived instance contexts]
- The bottom line
- compiler/typecheck/TcDerivUtils.hs
- compiler/typecheck/TcEnv.hs
- compiler/typecheck/TcErrors.hs
- Note [Deferring coercion errors to runtime]
- Note [Suppressing error messages]
- Note [Redundant constraints in instance decls]
- Note [Given errors]
- Note [Always warn with -fdefer-type-errors]
- Note [Deferred errors for coercion holes]
- Note [Do not report derived but soluble errors]
- Note [Constraints include …]
- Note [OutOfScope exact matches]
- Note [Inaccessible code]
- Note [Error messages for untouchables]
- Note [Suppress redundant givens during error reporting]
- Note [Insoluble occurs check wins]
- Note [Expanding type synonyms to make types similar]
- Note [Suggest adding a type signature]
- Note [Disambiguating (X ~ X) errors]
- Note [Reporting occurs-check errors]
- Note [Non-injective type functions]
- Note [Report candidate instances]
- Note [discardProvCtxtGivens]
- Note [Displaying potential instances]
- Note [Flattening in error message generation]
- Note [Kind arguments in error messages]
- Note [Runtime skolems]
- compiler/typecheck/TcEvidence.hs
- compiler/typecheck/TcExpr.hs
- Note [Type-checking overloaded labels]
- Note [Left sections]
- Note [Typing rule for ($)]
- Note [Typing rule for seq]
- Note [Type of a record update]
- Note [Implicit type sharing]
- Note [Criteria for update]
- Note [Data family example]
- Outgoing invariants
- Note [Mixed Record Field Updates]
- Note [Visible type application for the empty list constructor]
- Note [Required quantifiers in the type of a term]
- Note [Visible type application zonk]
- Note [tcSynArg]
- Note [Push result type in]
- Note [Partial expression signatures]
- Note [Adding the implicit parameter to ‘assert’]
- Note [tagToEnum#]
- Note [Instantiating stupid theta]
- Note [Lifting strings]
- Local record selectors
- Note [Disambiguating record fields]
- Note [Splitting nested sigma types in mismatched function types]
- Note [Finding the conflicting fields]
- Note [Not-closed error messages]
- Note [Checking closedness]
- compiler/typecheck/TcFlatten.hs
- Note [The flattening story]
- Why given-fsks, alone, doesn’t work
- Why flatten-meta-vars, alone doesn’t work
- Why is it right to treat fmv’s differently to ordinary unification vars?
- Note [Unflattening can force the solver to iterate]
- Note [The flattening work list]
- Note [Flattener EqRels]
- Note [Flattener CtLoc]
- Note [Lazy flattening]
- Note [Phantoms in the flattener]
- Note [No derived kind equalities]
- Note [Flattening]
- Note [flatten_args performance]
- Note [flatten_exact_fam_app_fully performance]
- Note [Flattening synonyms]
- Note [Flattening under a forall]
- Note [Reduce type family applications eagerly]
- Note [An alternative story for the inert substitution]
- Note [Unflatten using funeqs first]
- compiler/typecheck/TcForeign.hs
- compiler/typecheck/TcGenDeriv.hs
- compiler/typecheck/TcGenFunctor.hs
- Note [Deriving null]
- Note [DeriveFoldable with ExistentialQuantification]
- Note [FFoldType and functorLikeTraverse]
- Note [Generated code for DeriveFoldable and DeriveTraversable]
- Note [Phantom types with Functor, Foldable, and Traversable]
- Note [EmptyDataDecls with Functor, Foldable, and Traversable]
- compiler/typecheck/TcGenGenerics.hs
- compiler/typecheck/TcHoleErrors.hs
- compiler/typecheck/TcHsSyn.hs
- compiler/typecheck/TcHsType.hs
- Note [Wildcards in visible type application]
- Note [Dealing with :kind]
- Note [Bidirectional type checking]
- Note [Future-proofing the type checker]
- Note [Wildcards in visible kind application]
- Note [The Purely Kinded Type Invariant (PKTI)]
- Note [mkAppTyM]
- Note [saturateFamApp]
- Note [GADT kind self-reference]
- Note [Body kind of a HsForAllTy]
- Note [Body kind of a HsQualTy]
- Note [Inferring tuple kinds]
- Note [Desugaring types]
- Note [Kind of a type splice]
- Help functions for type applications
- Note [Keeping scoped variables in order: Explicit]
- Note [Keeping scoped variables in order: Implicit]
- Note [Recipe for checking a signature]
- Note [The initial kind of a type constructor]
- Note [No polymorphic recursion]
- Note [Kind-checking tyvar binders for associated types]
- Note [Kind variable ordering for associated types]
- Note [Levels and generalisation]
- Note [Kind generalisation]
- Note [Kinds of quantified type variables]
- Note [TyConBinders for the result kind signature of a data type]
- Note [Avoid name clashes for associated data types]
- Note [Extra-constraint holes in partial type signatures]
- Note [Pattern signature binders]
- compiler/typecheck/TcInstDcls.hs
- Note [How instance declarations are translated]
- Note [Instances and loop breakers]
- Note [ClassOp/DFun selection]
- Note [Single-method classes]
- Note [Subtle interaction of recursion and overlap]
- Note [Tricky type variable scoping]
- Note [Deriving inside TH brackets]
- Note [Associated type instances]
- Note [Result kind signature for a data family instance]
- Note [Eta-reduction for data families]
- Note [Default methods in the type environment]
- Note [Typechecking plan for instance declarations]
- Note [Recursive superclasses]
- Note [Solving superclass constraints]
- Note [Silent superclass arguments] (historical interest only)
- Note [Mismatched class methods and associated type families]
- Note [Avoid -Winaccessible-code when deriving]
- Note [Instance method signatures]
- Note [Export helper functions]
- Note [Default methods in instances]
- Note [INLINE and default methods]
- Note [SPECIALISE instance pragmas]
- compiler/typecheck/TcInteract.hs
- Note [Basic Simplifier Plan]
- Note [Unflatten after solving the simple wanteds]
- Note [Running plugins on unflattened wanteds]
- Note [The solveSimpleWanteds loop]
- Note [The Solver Invariant]
- Note [Replacement vs keeping]
- Note [Multiple matching irreds]
- Note [Solving irreducible equalities]
- Note [Do not add duplicate derived insolubles]
- Note [Shortcut solving]
- Solving fully
- Note [Shortcut solving: type families]
- Note [Shortcut solving: incoherence]
- Note [Shortcut try_solve_from_instance]
- Note [Shadowing of Implicit Parameters]
- Note [Type inference for type families with injectivity]
- Note [Cache-caused loops]
- Note [Efficient Orientation]
- Note [Carefully solve the right CFunEqCan]
- Note [Avoid double unifications]
- Note [Do not unify representational equalities]
- Note [FunDep and implicit parameter reactions]
- Note [Weird fundeps]
- Note [Looking up primitive equalities in quantified constraints]
- Note [Top-level reductions for type functions]
- Note [FunEq occurs-check principle]
- Note [Cached solved FunEqs]
- Note [MATCHING-SYNONYMS]
- Note [Improvement orientation]
- Note [No FunEq improvement for Givens]
- Note [Reduction for Derived CFunEqCans]
- Note [Instances in no-evidence implications]
- Note [Instance and Given overlap]
- Note [Naturally coherent classes]
- Note [Local instances and incoherence]
- compiler/typecheck/TcMType.hs
- Note [ExpType]
- Note [TcLevel of ExpType]
- Note [Skolemising type variables]
- Note [Kind substitution when instantiating]
- Note [TyVarTv]
- Note [Name of an instantiated type variable]
- Note [Unification variables need fresh Names]
- Note [Level check when unifying]
- Note [Never need to instantiate coercion variables]
- Note [Dependent type variables]
- Note [CandidatesQTvs determinism and order]
- Note [Naughty quantification candidates]
- Note [Order of accumulation]
- Note [Defaulting with -XNoPolyKinds]
- Note [What is a meta variable?]
- Note [What is zonking?]
- Note [Zonking to Skolem]
- Note [Silly Type Synonyms]
- Note [zonkCt behaviour]
- Note [Sharing in zonking]
- compiler/typecheck/TcMatches.hs
- compiler/typecheck/TcPat.hs
- compiler/typecheck/TcPatSyn.hs
- Note [Pattern synonym error recovery]
- Note [Remove redundant provided dicts]
- Note [Equality evidence in pattern synonyms]
- Note [Coercions that escape]
- Note [The pattern-synonym signature splitting rule]
- Note [Checking against a pattern signature]
- Note [Builder for a bidirectional pattern synonym]
- Note [Redundant constraints for builder]
- Note [As-patterns in pattern synonym definitions]
- Note [Type signatures and the builder expression]
- Note [Record PatSyn Desugaring]
- compiler/typecheck/TcRnDriver.hs
- compiler/typecheck/TcRnExports.hs
- compiler/typecheck/TcRnMonad.hs
- compiler/typecheck/TcRnTypes.hs
- Note [Identity versus semantic module]
- Note [Constraints in static forms]
- Note [Tracking unused binding and imports]
- Note [The Global-Env/Local-Env story]
- Note [Escaping the arrow scope]
- Note [Meaning of IdBindingInfo]
- Note [Bindings with closed types: ClosedTypeId]
- Note [Type variables in the type environment]
- Note [Complete and partial type signatures]
- Note [sig_inst_tau may be polymorphic]
- Note [Wildcards in partial signatures]
- Note [Hole constraints]
- Note [CIrredCan constraints]
- Note [Ct/evidence invariant]
- Note [Ct kind invariant]
- Note [Resetting cc_pend_sc]
- Note [Dropping derived constraints]
- Note [Custom type errors in constraints]
- Note [When superclasses help]
- Note [Given insolubles]
- Note [Insoluble holes]
- Note [Needed evidence variables]
- Note [Shadowing in a constraint]
- Note [Skolems in an implication]
- Note [Insoluble constraints]
- Note [Evidence field of CtEvidence]
- Note [Bind new Givens immediately]
- Note [Constraint flavours]
- Note [eqCanRewrite]
- Note [Wanteds do not rewrite Wanteds]
- Note [Deriveds do rewrite Deriveds]
- Note [funEqCanDischarge]
- Note [eqCanDischarge]
- Note [SubGoalDepth]
- Note [Skolem info for pattern synonyms]
- Note [SigSkol SkolemInfo]
- compiler/typecheck/TcRules.hs
- compiler/typecheck/TcSMonad.hs
- Note [WorkList priorities]
- Note [Prioritise equalities]
- Note [Prioritise class equalities]
- Note [Solved dictionaries]
- Note [Do not add superclasses of solved dictionaries]
- Note [Example of recursive dictionaries]
- Note [Detailed InertCans Invariants]
- Note [EqualCtList invariants]
- Note [Type family equations]
- Note [inert_eqs: the inert equalities]
- Note [Extending the inert equalities]
- Note [K3: completeness of solving]
- Note [Flavours with roles]
- Note [lookupFlattenTyVar]
- Note [Do not add duplicate quantified instances]
- Note [kickOutRewritable]
- Note [Rewrite insolubles]
- Note [Unsolved Derived equalities]
- Note [When does an implication have given equalities?]
- Note [Let-bound skolems]
- Note [Tuples hiding implicit parameters]
- Note [Solving CallStack constraints]
- Note [The TcS monad]
- Note [Do not inherit the flat cache]
- Note [Propagate the solved dictionaries]
- Getters and setters of TcEnv fields
- Note [Residual implications]
- compiler/typecheck/TcSigs.hs
- compiler/typecheck/TcSimplify.hs
- Note [Fail fast if there are insoluble kind equalities]
- Note [Fail fast on kind errors]
- Note [When to do type-class defaulting]
- Note [Must simplify after defaulting]
- Note [Top-level Defaulting Plan]
- Note [Safe Haskell Overlapping Instances]
- Note [Safe Haskell Overlapping Instances Implementation]
- Note [No defaulting in the ambiguity check]
- Note [Superclasses and satisfiability]
- Note [tcNormalise]
- Note [Inferring the type of a let-bound variable]
- Note [Emitting the residual implication in simplifyInfer]
- Note [Add signature contexts as givens]
- Note [Deciding quantification]
- Note [Promote momomorphic tyvars]
- Note [Quantification and partial signatures]
- Note [Growing the tau-tvs using constraints]
- Note [Quantification with errors]
- Note [Default while Inferring]
- Note [Minimize by Superclasses]
- Note [Avoid unnecessary constraint simplification]
- Note [Delete dead Given evidence bindings]
- Note [Tracking redundant constraints]
- Note [Cutting off simpl_loop]
- Note [ApproximateWC]
- Note [DefaultTyVar]
- Note [Promote _and_ default when inferring]
- Note [Promoting unification variables]
- Note [Float Equalities out of Implications]
- Note [Float equalities from under a skolem binding]
- Note [Which equalities to float]
- Note [Skolem escape]
- Note [What prevents a constraint from floating]
- Note [Avoiding spurious errors]
- Note [Multi-parameter defaults]
- compiler/typecheck/TcSplice.hs
- Note [How top-level splices are handled]
- Note [How brackets and nested splices are handled]
- Note [Template Haskell state diagram]
- Note [Template Haskell levels]
- Note [Running typed splices in the zonker]
- Note [Exceptions in TH]
- Note [Concealed TH exceptions]
- Note [Freshen reified GADT constructors’ universal tyvars]
- Note [Reifying field labels]
- compiler/typecheck/TcTyClsDecls.hs
- Note [Grouping of type and class declarations]
- Note [Check role annotations in a second pass]
- Note [Kind checking for type and class decls]
- Note [Skip decls with CUSKs in kcLTyClDecl]
- Open type families
- Note [How TcTyCons work]
- Note [Type environment evolution]
- Note [Missed opportunity to retain higher-rank kinds]
- Note [Don’t process associated types in kcLHsQTyVars]
- Note [Required, Specified, and Inferred for types]
- Associated types
- How it works
- Design alternatives
- Test cases (and tickets) relevant to these design decisions
- Note [Inferring kinds for type declarations]
- Note [Tricky scoping in generaliseTcTyCon]
- Note [Recursion and promoting data constructors]
- Note [Kind-checking for GADTs]
- Note [Type checking recursive type and class declarations]
- Note [Kind checking recursive type and class declarations]
- Note [Declarations for wired-in things]
- Note [Associated type defaults]
- Note [Type-checking default assoc decls]
- Note [Instantiating a family tycon]
- Note [Generalising in tcFamTyPatsGuts]
- Note [Constraints in patterns]
- Note [Quantifying over family patterns]
- Note [Quantified kind variables of a family pattern]
- Note [Infix GADT constructors]
- Note [Checking GADT return types]
- Note [mkGADTVars]
- Note [Substitution in template variables kinds]
- Note [Recover from validity error]
- Note [Class method constraints]
- Note [Abort when superclass cycle is detected]
- Note [Default method type signatures must align]
- Note [Splitting nested sigma types in class type signatures]
- Note [Checking partial record field]
- compiler/typecheck/TcTyDecls.hs
- Note [Superclass cycle check]
- Note [Role inference]
- Note [Role-checking data constructor arguments]
- Note [Coercions in role inference]
- Note [Default roles for abstract TyCons in hs-boot/hsig]
- Note [Default method Ids and Template Haskell]
- Note [Polymorphic selectors]
- Note [Naughty record selectors]
- Note [GADT record selectors]
- Note [Selector running example]
- compiler/typecheck/TcType.hs
- Note [TcTyVars and TyVars in the typechecker]
- Note [Coercion variables in free variable lists]
- Note [TcRhoType]
- Note [Signature skolems]
- Note [TyVars and TcTyVars during type checking]
- Note [TcLevel and untouchable type variables]
- Note [WantedInv]
- Note [Skolem escape prevention]
- Note [TcLevel assignment]
- Note [Silly type synonym]
- Note [anyRewritableTyVar must be role-aware]
- Note [Expanding superclasses]
- Note [Lift equality constaints when quantifying]
- Note [Quantifying over equality constraints]
- Note [Inheriting implicit parameters]
- Note [Quantifying over equality constraints]
- Note [AppTy and ReprEq]
- Note [Visible type application]
- Note [Foreign import dynamic]
- Note [Marshalling void]
- Note [Paterson conditions on PredTypes]
- compiler/typecheck/TcTypeNats.hs
- compiler/typecheck/TcTypeable.hs
- compiler/typecheck/TcUnify.hs
- Note [Herald for matchExpectedFunTys]
- Note [matchExpectedFunTys]
- Note [Subsumption checking: tcSubType]
- Wrinkle 1: Note [Deep skolemisation]
- Wrinkle 2: Note [Co/contra-variance of subsumption checking]
- Wrinkle 3: Note [Higher rank types]
- Note [Don’t skolemise unnecessarily]
- Note [Settting the argument context]
- Note [Deep instantiation of InferResult]
- Note [Promoting a type]
- Note [Promotion and higher rank types]
- Note [When to build an implication]
- Note [Check for equality before deferring]
- Note [Care with type applications]
- Note [Mismatched type lists and application decomposition]
- Note [Expanding synonyms during unification]
- Note [Deferred Unification]
- Note [TyVar/TyVar orientation]
- Note [Deeper level on the left]
- Note [Fmv Orientation Invariant]
- Note [Eliminate flat-skols]
- Note [Avoid unnecessary swaps]
- Note [Eliminate younger unification variables]
- Note [Prevent unification with type families]
- Note [Refactoring hazard: checkTauTvUpdate]
- Note [Type synonyms and the occur check]
- Note [Non-TcTyVars in TcUnify]
- Note [Unifying untouchables]
- Note [Occurrence checking: look inside kinds]
- Note [Checking for foralls]
- compiler/typecheck/TcValidity.hs
- Note [The ambiguity check for type signatures]
- Note [When to call checkAmbiguity]
- Note [Implicit parameters and ambiguity]
- Note [When we don’t check for ambiguity]
- Note [Higher rank types]
- Note [Correctness and performance of type synonym validity checking]
- Note [Unsaturated type synonyms in GHCi]
- Note [Type variables escaping through kinds]
- Note [Liberal type synonyms]
- Note [Implicit parameters in instance decls]
- Note [Validity checking for constraints]
- Note [ConstraintKinds in predicates]
- Note [Irreducible predicates in superclasses]
- Note [Simplifiable given constraints]
- Note [Kind polymorphic type classes]
- Note [Instances of built-in classes in signature files]
- Note [Casts during validity checking]
- Note [Validity checking of HasField instances]
- Note [Valid ‘deriving’ predicate]
- Note [Equality class instances]
- Note [Instances and constraint synonyms]
- Note [Paterson conditions]
- Note [Type families in instance contexts]
- Note [Invisible arguments and termination]
- Note [Check type-family instance binders]
- Note [Matching in the consistent-instantation check]
- Note [Checking consistent instantiation]
- Note [Printing conflicts with class header]
- Note [Unused explicitly bound variables in a family pattern]
- Note [Oversaturated type family equations]
- Note [Bad TyCon telescopes]
- Note [Ambiguous kind vars]