Matching function parameter to Type in parameter pack

I'm trying to remove a type from a parameter pack by "division" if you will. But the compiler tells me function/operator cannot be applied to the given operands. Is this expected behaviour or can I achieve this in a different way perhaps?

struct V<each U> { }

func /<each U1, each U2, U>(lhs: V<repeat each U1, U, repeat each U2>, rhs: V<U>) -> V<repeat each U1, repeat each U2> {
    .init()
}

let v1 = V<Int, Int, String, Int>()
let v2 = V<String>()

let v3 = v1 / v2 // Binary operator '/' cannot be applied to operands of type 'V<Int, Int, String, Int>' and 'V<String>'
// I would have expected v3 to be of type V<Int, Int, Int>
1 Like

Would be really interested to know why this isn't currently possible and if it's expected.

This is not supported. The rules for unification of pack types are documented in the “type matching” section of the proposal—they’re probably a bit simpler than what you’re imagining: swift-evolution/proposals/0393-parameter-packs.md at main · apple/swift-evolution · GitHub

Ah thanks for pointing me to those! Could you see any other way of achieving this? I'm trying to achieve a way to have type safe unit measurements and freely converting from one to the other without explicitly defining every combination.
I have that partly working with nested generics, but it could be greatly simplified by using a variadic operation like I was trying above.