[Pre-RFC] The error-handling approach in manner of static dispatch, using enum exchange

I can’t help but think it’s possible with frunk::Coprod. It definitely needs specialization and/or types promising to never implement a trait to pass the orphan rules, but I think it’s probably possible.

impl<Head, Tail> From<Coproduct<Head, Tail>> for T
where
    Head: Into<Self>,
    Tail: Into<Self>,
{ .. }

impl<Head> From<Coproduct<Head, CNil>> for T
where
    Head: Into<Self>,
{ .. }

Since Coprod is basically just (((A | B) | C) | ()), it can be done recursively. So that signature would be something along the lines of:

default impl<Head, Tail, Other> From<Other>
where
    Other: Into<Coproduct<Head, Tail>>,
    Coproduct<Head, Tail>: Into<Self>,
{
    fn from(other: Other) -> Self {
        let coprod: Coroduct<Head, Tail> = other.into();
        coprod.into()
    }
}