ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Tc.Instance.Class

Synopsis

- matchGlobalInst :: DynFlags -> Bool -> Class -> [Type] -> TcM ClsInstResult
- data ClsInstResult
  - = NoInstance
  - | OneInst {
    - cir_new_theta :: [TcPredType]
    - cir_mk_ev :: [EvExpr] -> EvTerm
    - cir_what :: InstanceWhat
    }
  - | NotSure
- data InstanceWhat
  - = BuiltinEqInstance
  - | BuiltinTypeableInstance TyCon
  - | BuiltinInstance
  - | LocalInstance
  - | TopLevInstance {
    - iw_dfun_id :: DFunId
    - iw_safe_over :: SafeOverlapping
    }
- 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 #

data ClsInstResult Source #

Constructors

NoInstance |
OneInst |

Fields

- cir_new_theta :: [TcPredType]
- cir_mk_ev :: [EvExpr] -> EvTerm
- 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

#### Instances

Instances details

Outputable InstanceWhat Source # |
Instance details Defined in GHC.Tc.Instance.Class 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 #