lean4-htt/tests/lean/coe4.lean
Leonardo de Moura d7c3fce8a3 feat(library/init/coe,frontends/lean): more general coercions to fun
The new test dep_coe_to_fn.lean motivates the change.
2016-09-27 15:41:06 -07:00

25 lines
427 B
Text

universe variables u
structure Functor (A : Type u) :=
(fn : A → A → A) (inj : ∀ x y, fn x = fn y → x = y)
attribute [instance]
definition coe_functor_to_fn (A : Type u) : has_coe_to_fun (Functor A) :=
{ F := λ f, A → A → A,
coe := Functor.fn }
constant f : Functor nat
check f 0 1
set_option pp.coercions false
check f 0 1
set_option pp.coercions true
check f 0 1
set_option pp.all true
check f 0 1