Expand description
IO primitives: results (EST.Out), handles (the standard streams and files), streams,
ST.Ref and the monotonic clocks.
In Lean 4.35 an IO action returns an EST.Out (ok = constructor 0, error =
constructor 1, one object field), while a BaseIO/ST action returns its value itself. The
world parameter has the IR type void and is not passed to externs.
Structs§
- File
State - An open file and the bytes read from it ahead of the reader.
Enums§
- Handle
File - The file behind a
IO.FS.Handle.
Functions§
- lean_
get_ ⚠set_ stderr IO.setStderr : IO.FS.Stream → BaseIO IO.FS.Stream.- lean_
get_ ⚠set_ stdin IO.setStdin : IO.FS.Stream → BaseIO IO.FS.Stream(returns the previous stream).- lean_
get_ ⚠set_ stdout IO.setStdout : IO.FS.Stream → BaseIO IO.FS.Stream.- lean_
get_ ⚠stderr IO.getStderr : BaseIO IO.FS.Stream.- lean_
get_ ⚠stdin IO.getStdin : BaseIO IO.FS.Stream.- lean_
get_ ⚠stdout IO.getStdout : BaseIO IO.FS.Stream.- lean_
io_ ⚠exit IO.Process.exit : UInt8 → IO α.- lean_
io_ ⚠mk_ world - lean_
io_ ⚠mono_ ms_ now IO.monoMsNow : BaseIO Nat.- lean_
io_ ⚠mono_ nanos_ now IO.monoNanosNow : BaseIO Nat.- lean_
io_ ⚠prim_ handle_ flush Handle.flush : (@& Handle) → IO Unit.- lean_
io_ ⚠prim_ handle_ get_ line Handle.getLine : (@& Handle) → IO String: up to and including the next newline.- lean_
io_ ⚠prim_ handle_ is_ tty Handle.isTty : (@& Handle) → BaseIO Bool.- lean_
io_ ⚠prim_ handle_ lock Handle.lock : (@& Handle) → (exclusive : Bool) → IO Unit.- lean_
io_ ⚠prim_ handle_ mk Handle.mk : (@& FilePath) → FS.Mode → IO Handle:read,write,writeNew,readWriteorappend(0–4).- lean_
io_ ⚠prim_ handle_ put_ str Handle.putStr : (@& Handle) → (@& String) → IO Unit.- lean_
io_ ⚠prim_ handle_ read Handle.read : (@& Handle) → USize → IO ByteArray.- lean_
io_ ⚠prim_ handle_ rewind Handle.rewind : (@& Handle) → IO Unit.- lean_
io_ ⚠prim_ handle_ truncate Handle.truncate : (@& Handle) → IO Unit: truncates the file at the reader’s position.- lean_
io_ ⚠prim_ handle_ try_ lock Handle.tryLock : (@& Handle) → (exclusive : Bool) → IO Bool.- lean_
io_ ⚠prim_ handle_ unlock Handle.unlock : (@& Handle) → IO Unit.- lean_
io_ ⚠prim_ handle_ write Handle.write : (@& Handle) → (@& ByteArray) → IO Unit.- lean_
io_ ⚠result_ get_ error - lean_
io_ ⚠result_ get_ value - lean_
io_ ⚠result_ is_ error - lean_
io_ ⚠result_ is_ ok - lean_
io_ ⚠result_ mk_ error - lean_
io_ ⚠result_ mk_ ok - lean_
io_ ⚠result_ show_ error - Prints
uncaught exception: <IO.Error.toString e>for anerrorresult (borrowed). - lean_
io_ ⚠result_ take_ value - The value of an
okresult (consumesr). - lean_
io_ ⚠wrap_ handle - An
IO.FS.Handleforf. - lean_
runtime_ ⚠mark_ multi_ threaded Runtime.markMultiThreaded : α → BaseIO α(objects stay single-threaded).- lean_
runtime_ ⚠mark_ persistent Runtime.markPersistent : α → BaseIO α.- lean_
st_ ⚠mk_ ref ST.Prim.mkRef(consumesa).- lean_
st_ ⚠ref_ get ST.Prim.Ref.get(borrows the ref).- lean_
st_ ⚠ref_ ptr_ eq ST.Prim.Ref.ptrEq.- lean_
st_ ⚠ref_ put ST.Prim.Ref.set(consumesa).- lean_
st_ ⚠ref_ swap ST.Prim.Ref.swap(consumesa, returns the old value).- lean_
st_ ⚠ref_ take ST.Prim.Ref.take: the value, leaving the ref empty.- lean_
stream_ ⚠of_ handle IO.FS.Stream.ofHandle(consumesh).