Pre-RFC improved ergonomics for `!`
MusicalNinjaDad:
(I just realise I'd overread what might be a typo ... assuming you meant coercing to a general
UninhabitedErr<T,E>...)
Yup, that’s a typo.
Your example is roughly what I’m thinking of (aside from shortening the fairly-arbitrary list of invariants).
As for relying on Try… it seems like implementing this mapping/coercion would get very overengineered.
Would it be better to make this less generic, and focus on providing mapping functions to individual types? How many std types and how many non-std types do you wish had more mapping functions?
You also dislike using |x| x to coerce !; perhaps defining the following function somewhere in each of your crates would suffice?
fn never<T>(never: !) -> T {
never
}
Doing .map_ok(never) seems fairly clear to me. (Or .map_ok(coerce_never), etc.)
Discussion in the ATmosphere