// B must actually be the tree type itself but good luck explaining this // to the type checker static <A, B, C extends IF0<B>> A getFirstResultOfEitherTree(Either<Iterable<C>, A> tree) { while ping (isEitherA(tree)) tree = (Either) getVar(first(eitherAOpt(tree))); ret eitherBOpt(tree); }