Effect's Terminal; the constructor is Terminal.make.
Attributes#
| Attribute | Type | Description |
|---|---|---|
columns | Effect[int] | The terminal's width in character cells. Never fails. |
rows | Effect[int] | The terminal's height in character cells. Never fails. |
size | Effect[Dequeue[Size, Done], Never, Scope] | A queue holding the current |
read_input | Effect[Dequeue[UserInput, Done], Never, Scope] | A queue of key presses from standard input for as long as the scope is open; it ends when input ends or the user quits. Never fails. |
read_line | Effect[str, QuitError] | Reads one line from standard input, without its line break.
Fails with |
Functions#
__init__#
__init__(*, columns, rows, size, read_input, read_line, display) -> None| Parameter | Type | Description |
|---|---|---|
columns | Effect[int] | |
rows | Effect[int] | |
size | Effect[Dequeue[Size, Done], Never, Scope] | |
read_input | Effect[Dequeue[UserInput, Done], Never, Scope] | |
read_line | Effect[str, QuitError] | |
display | Callable[[str], Effect[None, PlatformError]] |
def __init__(
self,
*,
columns: Effect[int],
rows: Effect[int],
size: Effect[Dequeue[Size, Done], Never, Scope],
read_input: Effect[Dequeue[UserInput, Done], Never, Scope],
read_line: Effect[str, QuitError],
display: Callable[[str], Effect[None, PlatformError]],
) -> None:
for name, value in (
("columns", columns),
("rows", rows),
("size", size),
("read_input", read_input),
("read_line", read_line),
):
require_effect(value, name)
self._columns = columns
self._rows = rows
self._size = size
self._read_input = read_input
self._read_line = read_line
self._display = displaydisplay#
display(text) -> Effect[None, PlatformError]Writes text to standard output. Fails with a
PlatformError when the write does.
| Parameter | Type | Description |
|---|---|---|
text | str |
Returns Effect[None, PlatformError]
def display(self, text: str) -> Effect[None, PlatformError]:
"""Writes ``text`` to standard output. Fails with a
``PlatformError`` when the write does."""
return self._display(text)