aboutsummaryrefslogtreecommitdiff
path: root/rng.ha
diff options
context:
space:
mode:
Diffstat (limited to 'rng.ha')
-rw-r--r--rng.ha14
1 files changed, 10 insertions, 4 deletions
diff --git a/rng.ha b/rng.ha
index 93405b4..24e5177 100644
--- a/rng.ha
+++ b/rng.ha
@@ -6,6 +6,7 @@ use os;
use strconv;
use sort;
use sort::cmp;
+use io;
export fn main() void = {
const cmd = getopt::parse(os::args,
@@ -58,16 +59,21 @@ export fn main() void = {
sort::sort(rngs: []opaque, size(u32), &cmp::u32s);
};
- printrngs(rngs, sep);
+ match (printrngs(rngs, sep)) {
+ case void =>
+ yield;
+ case let e: io::error =>
+ fmt::fatal(io::strerror(e));
+ };
};
-fn printrngs(rngs: []u32, sep: str) void = {
+fn printrngs(rngs: []u32, sep: str) (void | io::error) = {
let s = "";
for (const rng .. rngs) {
- fmt::printf("{}{}", s, rng)!;
+ fmt::printf("{}{}", s, rng)?;
s = sep;
};
- fmt::println()!;
+ fmt::println()?;
};
fn contains(a: []u32, b: u32) bool = {