IO mode for opening files.
$$\text{IOMode} ::= \text{readMode} \mid \text{writeMode} \mid \text{appendMode} \mid \text{readWriteMode}$$
- readMode : IOMode
Open for reading.
- writeMode : IOMode
Open for writing (truncates existing content).
- appendMode : IOMode
Open for appending.
- readWriteMode : IOMode
Open for both reading and writing.
Instances For
Equations
Equations
- System.SysIO.instBEqIOMode.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- System.SysIO.instReprIOMode = { reprPrec := System.SysIO.instReprIOMode.repr }
Handle is an alias for Lean's IO.FS.Handle.
$$\text{Handle} \triangleq \text{IO.FS.Handle}$$
Equations
Instances For
Standard input stream.
$$\text{stdin} : \text{IO}\ \text{IO.FS.Stream}$$
Equations
Instances For
Standard output stream.
$$\text{stdout} : \text{IO}\ \text{IO.FS.Stream}$$
Equations
Instances For
Standard error stream.
$$\text{stderr} : \text{IO}\ \text{IO.FS.Stream}$$
Equations
Instances For
Write a string to a handle.
$$\text{hPutStr} : \text{Handle} \to \text{String} \to \text{IO}\ \text{Unit}$$
Equations
- System.SysIO.hPutStr h s = IO.FS.Handle.putStr h s
Instances For
Write a string followed by a newline to a handle.
$$\text{hPutStrLn} : \text{Handle} \to \text{String} \to \text{IO}\ \text{Unit}$$
Equations
- System.SysIO.hPutStrLn h s = do IO.FS.Handle.putStr h s IO.FS.Handle.putStr h "\n"
Instances For
Read a line from a handle.
$$\text{hGetLine} : \text{Handle} \to \text{IO}\ \text{String}$$
Equations
Instances For
Flush a handle's output buffer.
$$\text{hFlush} : \text{Handle} \to \text{IO}\ \text{Unit}$$
Equations
Instances For
Read all remaining contents from a handle.
$$\text{hGetContents} : \text{Handle} \to \text{IO}\ \text{String}$$
Uses Lean's readToEnd which reads until EOF.
Equations
Instances For
Convert an IOMode to Lean's IO.FS.Mode.
$$\text{toFSMode} : \text{IOMode} \to \text{IO.FS.Mode}$$
Equations
Instances For
Open a file with the given mode, use it via the callback, then return.
$$\text{withFile} : \text{FilePath} \to \text{IOMode} \to (\text{Handle} \to \text{IO}\ \alpha) \to \text{IO}\ \alpha$$
The handle is scoped to the callback f.
Equations
- System.SysIO.withFile path mode f = do let h ← IO.FS.Handle.mk path (System.SysIO.toFSMode mode) f h
Instances For
Convenience: write a string to stdout.
$$\text{putStr} : \text{String} \to \text{IO}\ \text{Unit}$$
Equations
Instances For
Convenience: write a string with newline to stdout.
$$\text{putStrLn} : \text{String} \to \text{IO}\ \text{Unit}$$
Equations
Instances For
Convenience: read a line from stdin.
$$\text{getLine} : \text{IO}\ \text{String}$$
Equations
- System.SysIO.getLine = do let __do_lift ← liftM IO.getStdin __do_lift.getLine