The new definitions are not fully general since they force data and state to be in the same universe.
16 lines
291 B
Text
16 lines
291 B
Text
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
|