Skip to content

Commit

Permalink
Don't use internal prelude API
Browse files Browse the repository at this point in the history
  • Loading branch information
tynanbe committed Jun 13, 2024
1 parent 1fbc8a2 commit 8214193
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rad_ffi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const ok_signals = [...Array(3)].map((_, i) => i + 385);
export function watch_loop(watch_fun, do_fun) {
while (true) {
let result = watch_fun();
if (result.isOk()) {
if (result instanceof Ok) {
do_fun();
} else if (ok_signals.includes(result[0][0])) {
// Exit successfully on some signals.
Expand Down Expand Up @@ -170,15 +170,15 @@ export function decode_object(data) {

export function toml_decode_every(toml, key_path, decoder) {
let result = toml_get(toml, key_path);
if (!result.isOk()) {
if (result instanceof GleamError) {
let decode_error = new DecodeError("field", "nothing", key_path);
return new GleamError(toList([decode_error]));
}
toml = result[0];
let items = Object.keys(toml)
.map((key) => {
let result = decoder(toml[key]);
return [key, result.isOk() ? result[0] : Nil];
return [key, result instanceof Ok ? result[0] : Nil];
})
.filter(([_key, value]) => Nil !== value);
return new Ok(toList(items));
Expand Down

0 comments on commit 8214193

Please sign in to comment.