lean4-htt/tests/lean/run/io_state.lean
2017-03-09 18:41:19 -08:00

17 lines
288 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import system.io
open io state_t
@[reducible] def my_io := state_t nat io
instance lift_io {α} : has_coe (io α) (my_io α) :=
⟨state_t.lift⟩
def tst : my_io unit :=
do x ← read,
put_ln x,
write (x+10),
y ← read,
put_ln y,
put_str "end of program"
#eval tst 5