(m stands for Monad)
The sequencing operator.
Results in an IO action, that, when run, runs m, passes the resulting value to handler and then runs the result.
This specifies the order in which actions are executed.
Example:
puts! "Hello world" ;\_ puts! "Second line"
Output:
Hello world Second line
Constructs an IO action, that, when run, returns value.
Constructs an IO action, that, when run, returns value.
Given an IO action, results in the value of the monad.
Given an IO action, results in the World State of the monad.
Given a condition (predicate) and a body, does the following:
Given a condition (predicate) and a body, does the following:
(Eventually) does the following:
Example:
FIXME
(Eventually) does the following:
Example:
... get f somehow ... defer! (File.fclose! f) File.fgets! file 2000
(Eventually) does the following:
This is convenient for resource management where you have some clean-up action that has to execute no matter what.
Example:
use! (File.fopen! "/etc/passwd" "r") File.fclose! \file File.fgets! file 2000
Using obj, does body (see use! above for what "using" means).
Example:
let passwd := let open! := File.fopen! "/etc/passwd" "r" in let close! := File.fclose! in let gets! := File.fgets! in Composition.dispatch (#exports [open! close!]) OO.Object in with! passwd \file let passwd := wrap passwd file in passwd.gets! file 2000