GHC.Tc.Instance.Class

ghc-9.10.0.20240328: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Instance.Class

Synopsis

- matchGlobalInst :: DynFlags -> Bool -> Class -> [Type] -> TcM ClsInstResult
- matchEqualityInst :: Class -> [Type] -> (DataCon, Role, Type, Type)
- data ClsInstResult
  - = NoInstance
  - | OneInst {
    - cir_new_theta :: [TcPredType]
    - cir_mk_ev :: [EvExpr] -> EvTerm
    - cir_canonical :: Canonical
    - cir_what :: InstanceWhat
    }
  - | NotSure
- data InstanceWhat
  - = BuiltinEqInstance
  - | BuiltinTypeableInstance TyCon
  - | BuiltinInstance
  - | LocalInstance
  - | TopLevInstance {
    - iw_dfun_id :: DFunId
    - iw_safe_over :: SafeOverlapping
    - iw_warn :: Maybe (WarningTxt GhcRn)
    }
- safeOverlap :: InstanceWhat -> Bool
- instanceReturnsDictCon :: InstanceWhat -> Bool
- data AssocInstInfo
  - = NotAssociated
  - | InClsInst {
    - ai_class :: Class
    - ai_tyvars :: [TyVar]
    - ai_inst_env :: VarEnv Type
    }
- isNotAssociated :: AssocInstInfo -> Bool

# Documentation

matchGlobalInst :: DynFlags -> Bool -> Class -> [Type] -> TcM ClsInstResult Source #

matchEqualityInst :: Class -> [Type] -> (DataCon, Role, Type, Type) Source #

data ClsInstResult Source #

Constructors

NoInstance |
OneInst |
Fields cir_new_theta :: [TcPredType] cir_mk_ev :: [EvExpr] -> EvTerm cir_canonical :: Canonical cir_what :: InstanceWhat
NotSure |

#### Instances

Instances details

Outputable ClsInstResult Source # |
Instance details Defined in GHC.Tc.Instance.Class Methods ppr :: ClsInstResult -> SDoc Source #

data InstanceWhat Source #

Constructors

BuiltinEqInstance |
BuiltinTypeableInstance TyCon |
BuiltinInstance |
LocalInstance |
TopLevInstance |
Fields iw_dfun_id :: DFunId iw_safe_over :: SafeOverlapping iw_warn :: Maybe (WarningTxt GhcRn)

#### Instances

Instances details

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

safeOverlap :: InstanceWhat -> Bool Source #

instanceReturnsDictCon :: InstanceWhat -> Bool Source #

data AssocInstInfo Source #

Extra information about the parent instance declaration, needed when type-checking associated types. The `Class` is the enclosing class, the [TyVar] are the scoped type variable of the instance decl. The `VarEnv Type` maps class variables to their instance types.

Constructors

NotAssociated |
InClsInst |
Fields ai_class :: Class ai_tyvars :: [TyVar] The scoped tyvars of the instance Why scoped? See bind_me in `checkConsistentFamInst` ai_inst_env :: VarEnv Type Maps class tyvars to their instance types See Note [Matching in the consistent-instantiation check]

isNotAssociated :: AssocInstInfo -> Bool Source #