I think result handling is definitely an area I think can be improved, but when faced with something like this I’d just use exceptions and hide it away in some kind of util function that does the throwing for me
let result = str->Argv.process((name, acc) =>
switch name {
| "a" => getA(acc)
| "b" => getB(acc)
}
})
I use a json decoding lib that does it this way and quite like it, and handling multiple results is usually done in one place at the bounds