Skip to main content

IO

Import IO for effectful host operations. Recoverable operations return Result; costs depend on the installed host and payload size.

Files

readText!

readText! :: Text -> Result(IOError, Text).

Reads the file at the supplied path as strict UTF-8. Success returns Ok text. Failure returns Err with an IOError that includes the path when available.

writeText!

writeText! :: Text -> Text -> Result(IOError, ()).

Writes the second argument to the path supplied first using strict UTF-8. Success returns Ok (); failure returns an error with the path when available.

Standard streams

readStdin!

readStdin! :: () -> Result(IOError, Text).

Reads standard input as strict UTF-8. Stream errors do not attach a path.

writeStdout!

writeStdout! :: Text -> Result(IOError, ()).

Writes text to standard output. Success returns Ok (); stream errors do not attach a path.

writeStderr!

writeStderr! :: Text -> Result(IOError, ()).

Writes text to standard error. Success returns Ok (); stream errors do not attach a path.

Process

arguments!

arguments! :: () -> List(Text).

Returns process arguments in host-provided order.

exit!

exit! :: Int -> ().

Terminates through the installed runtime host with a status from 0 through 255. An out-of-range status fails with fatal diagnostic E3030 before the host is called.

The ! suffix participates in Jazz's current purity contract.