aboutsummaryrefslogtreecommitdiff
path: root/std/prelude/io.pk
blob: e621e0139b639eb12a8c07c5807ccb0eaa0cb225 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## std.io: Platform-independent I/O constructs.
## This module is imported by default.

pub type File = ...
pub type FileMode = union[Read, Write, ReadWrite, Append]

# todo: file destructors call `close`

pub const stdout: File = ...
pub const stdin: File = ...
pub const stderr: File = ...

pub func open(path: str, mode: FileMode): File =
  ...

pub func close(file: File) =
  ...

pub func write(file: File, values: varargs[str]) =
  ...

pub func read(file: File): str? =
  ...

pub func lines(file: File): Iter[str] =
  ...

pub func chars(file: File): Iter[chr] =
  ...