The @[coe]
attribute, used to delaborate coercion functions as ↑
#
When writing a coercion, if the pattern
@[coe]
def A.toB (a : A) : B := sorry
instance : Coe A B where coe := A.toB
is used, then A.toB a
will be pretty-printed as ↑a
.
The different types of coercions that are supported by the coe
attribute.
- coe : CoeFnType
The basic coercion
↑x
, seeCoeT.coe
- coeFun : CoeFnType
The coercion to a function type, see
CoeFun.coe
- coeSort : CoeFnType
The coercion to a type, see
CoeSort.coe
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.Meta.instReprCoeFnType.repr Lean.Meta.CoeFnType.coe prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Lean.Meta.CoeFnType.coe")).group prec✝
- Lean.Meta.instReprCoeFnType.repr Lean.Meta.CoeFnType.coeFun prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Lean.Meta.CoeFnType.coeFun")).group prec✝
Instances For
Equations
- Lean.Meta.instReprCoeFnType = { reprPrec := Lean.Meta.instReprCoeFnType.repr }
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
Instances For
Equations
- Lean.Meta.instReprCoeFnInfo = { reprPrec := Lean.Meta.instReprCoeFnInfo.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
The environment extension for tracking coercion functions for delaboration
Lookup the coercion information for a given function
Equations
- Lean.Meta.getCoeFnInfo? fn = do let __do_lift ← Lean.getEnv pure ((Lean.ScopedEnvExtension.getState Lean.Meta.coeExt __do_lift).find? fn)