The implementation of Result.equal and Result.compare seems wrong as it treats any two errors as equal.
This is also the case with Belt.eq and Belt.cmp where this was likely copied from.
OCaml does this correctly in https://ocaml.org/manual/5.3/api/Result.html, equal and compare both take two functions, one for comparing the ok case and one for the error case.