lean4-htt/tests/lean/run/thunk_overload.lean
Leonardo de Moura 6e7929252f feat(frontends/lean, library/init): add 'thunk' gadget
We can now write
   trace "hello" t
instead of
   trace "hello" (fun _, t)
2017-01-31 18:41:59 -08:00

41 lines
515 B
Text

/- Thunk gadget works with overloaded functions -/
namespace foo
def f (a : nat) (b : thunk nat) : nat :=
a + b ()
end foo
namespace boo
def f (a : bool) (b : bool) : bool :=
a && b
end boo
namespace bla
def f (a : bool) (b : thunk nat) : nat :=
if a then b() else 42
end bla
open foo boo bla
example : f 10 10 = 20 :=
rfl
example : f 10 10 = foo.f 10 10 :=
rfl
example : f tt tt = tt :=
rfl
example : f tt tt = boo.f tt tt :=
rfl
example : f tt 10 = 10 :=
rfl
example : f tt 10 = bla.f tt 10 :=
rfl