std.io
Modules
std.io.read |
Functions and types for working with Read ers.
|
std.io.write |
Functions and types for working with Write rs.
|
Functions for working with I/O
Types
type File = <opaque>
type OpenOptions =
| Read
| Write
| Append
| Truncate
| Create
| CreateNew
type IO a = <opaque>
Values
Opens the file at path
in read-only mode. Fails if the file does not
exist.
let create_file path : String -> IO File
Opens a file in write-only mode. If the file already exists, it will be truncated. If the file does not exist, it will be created.
A Functor
represents an action on a parameterized type which does not
change the structure with the mapped type.
The following laws should hold:
map id == id
map (f << g) == map f << map g
#[implicit]
let applicative : Applicative IO
A Functor
with application.
The following laws should hold:
wrap id <*> v = v
wrap (<<) <*> u <*> v <*> w = u <*> (v <*> w)
wrap f <*> wrap x = wrap (f x)
u <*> wrap y = wrap (\g -> g x) <*> u
A generalised interface for imperatively sequencing actions
Allows reading bytes from a
. Generally, reading from a reader
advances its internal cursor. This means that multiple read
calls
with the same arguments usually do not return the same value.
Allows writing bytes to a sink. To ensure that all data has been written,
writes have to be paired with a flush
.
#[implicit]
let disposable : Disposable File
A resource that has to be released after use, for example a file handle or a database connection.