@kha: I decided to implement this change before I start the type_context modifications. The change did not affect the corelib and test suite much. The only annoying problem is that `out` cannot be used to name locals anymore.
30 lines
464 B
Text
30 lines
464 B
Text
import system.io
|
|
open io
|
|
variable [io.interface]
|
|
|
|
def tst1 : io unit :=
|
|
do o ← stdout,
|
|
-- fs.put_str_ln out "hello",
|
|
fs.close o
|
|
|
|
#eval tst1
|
|
#eval tst1
|
|
|
|
def tst2 : io unit :=
|
|
do o ← stderr,
|
|
-- fs.put_str_ln out "world",
|
|
fs.close o
|
|
|
|
#eval tst2
|
|
|
|
def tst3 : io unit :=
|
|
do h ← mk_file_handle "io_fs_error.lean" io.mode.read,
|
|
fs.close h,
|
|
fs.close h
|
|
|
|
#eval tst3
|
|
|
|
def tst4 : io handle :=
|
|
mk_file_handle "bad_file_name.txt" io.mode.read
|
|
|
|
#eval tst4
|