Std.Console
Console
Section titled “Console”effect ConsoleWrites a line to standard output (print_line) or standard error (print_error_line).
-
fn print_line(text: String) -> ()Writes
textand a line ending to standard output. -
fn print_error_line(text: String) -> ()Writes
textand a line ending to standard error.
SystemConsole
Section titled “SystemConsole”handler SystemConsole: ConsoleWrites to the host’s standard output and standard error, through the same path as SystemStdout
and SystemStderr of Std.Process (JS: file descriptors 1 and 2, or console.log and
console.error on a host without them; C stdout and stderr). Stateless.
TestConsole
Section titled “TestConsole”handler TestConsole: Consoleuses { State[List[String]] }The test handler ([effect.state]). It keeps the printed lines in State[List[String]], so
use it inside State.run:
(_, lines) = State.run([], || with TestConsole { greet(1) })assert lines == ["Hello, alice!"]print_line appends the line in the printed order. print_error_line drops the line.