lean4-htt/tests/lean/file_not_found.lean
Leonardo de Moura fda1d7b213 refactor: elabAppArgsAux
It also adds better support for opt/auto params and named arguments.
2020-10-11 15:08:12 -07:00

18 lines
576 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.

prelude
import Init.System.IO
new_frontend
open IO.FS
def usingIO {α} (x : IO α) : IO α := x
#eval (discard $ IO.FS.Handle.mk "non-existent-file.txt" Mode.read : IO Unit)
#eval usingIO do
condM (IO.fileExists "readonly.txt")
(pure ())
(IO.FS.withFile "readonly.txt" Mode.write $ fun _ => pure ());
IO.setAccessRights "readonly.txt" { user := { read := true } };
pure ()
#eval (discard $ IO.FS.Handle.mk "readonly.txt" Mode.write : IO Unit)
#eval usingIO do
let h ← IO.FS.Handle.mk "readonly.txt" Mode.read;
h.putStr "foo";
IO.println "foo";
pure ()