lean4-htt/tests/lean/io_fs_error.lean
Leonardo de Moura f0352d31a1 feat(library/type_context, library): inout ==> out modifier in type class declarations
@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.
2017-12-15 14:46:47 -08:00

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