-
Notifications
You must be signed in to change notification settings - Fork 466
Closed
Description
I was hoping that this would work:
std.mergePatch(
{ a: error "nope" },
{ a: "ok" }
)
but unfortunately that results in a runtime error, because mergePatch has to check the type of each field, and std.type(error "err")
is also a runtime error.
I think it would be possible to make the above example work by checking the type of the replacement value before considering the original value, and ignoring the original value unless the replacement is an object. But it still wouldn't be possible to do this:
std.mergePatch(
{ a: error "nope" },
{ a: { b: "ok" } }
)
So now I'm wondering: Would it break the world to make std.type(error "nope")
return "error"
instead of an error? Or as an alternative, what about adding a boolean stdlib function like std.isError(x)
?
nikolay and laundry
Metadata
Metadata
Assignees
Labels
No labels