Pre-RFC: `fold_ok` is composable internal iteration

Does Try fix any of the problems Carrier caused in this? Something like this:

fn try_fold<F, T: Try>(self, init: T::Ok, mut f: F) -> T where
    Self: Sized, F: FnMut(T::Ok, Self::Item) -> T,
{
    let mut accum = init;
    for x in self {
        accum = f(accum, x)?;
    }
    Try::from_ok(accum)
}

Since the closure constructs a concrete impl Try, the experiment I tried had the method inferring fine.

1 Like