lean4-htt/tests/lean/run/io_state.lean
Leonardo de Moura 6887a99f08 feat(library/init/category/state): make state and state_t universe polymorphic
The new definitions are not fully general since they force data and
state to be in the same universe.
2017-03-22 23:45:29 -07:00

16 lines
291 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,
print_ln x,
write (x+10),
y ← read,
print_ln y,
put_str "end of program"
#eval tst 5