lean4-htt/tests/lean/run/coe_opt.lean
Leonardo de Moura 49a0d13c50 feat(library/init/coe): add coercion from A to (option A)
A little hack is used to make sure type class resolution will not enter
in an infinite loop.
2017-01-31 17:45:41 -08:00

12 lines
204 B
Text

def f : nat → option nat → nat
| a none := a
| a (some b) := a + b
example (a b : nat) : f a b = a + b :=
rfl
example (a b : nat) : f a b = f a (some b) :=
rfl
example : f 1 (1:nat) = 2 :=
rfl