Swift parameter pack specialization

:wave:t3:

I'm trying to do something a little clever with parameter packs. I have a generic configuration, that has a matching type erasure so that it can be stored in a homogenous array. I have it all working, where the type erasing is able to call the generic functionality that is captured in it's initializer via closures.

Struct below. Type erasure not shown as it's not relevant to the question

struct QueryConfiguration<ResponseModel: QueryResponseProtocol, ComparisonModel: ListingComparisonModel, each T: QueryResponseProtocol>: Equatable {
	static func == (lhs: QueryConfiguration<ResponseModel, ComparisonModel, repeat each T>, rhs: QueryConfiguration<ResponseModel, ComparisonModel, repeat each T>) -> Bool {
		lhs.id == rhs.id
	}
	
	var id: QueryIdentifier
	var dependencies: [QueryIdentifier] { id.dependencies }
	
	// a method needs to be called that passes the configuration the comparison model, and the retrieved response models
	var serviceHandler: (ComparisonModel, (repeat (RequestState<each T>?))) -> ResponseModel.Service?
	
	
	func comparisonModel(with listing: ListingModel) -> ComparisonModel? {
		ComparisonModel(listing)
	}
	
	func service(_ model: ComparisonModel, _ values: repeat (RequestState<each T>?)) -> ResponseModel.Service? {
		serviceHandler(model, (repeat each values))
	}
}

However, I'm running into issues when I'm trying to define static instances of the generic struct. If I start to add extra types to the end of the Type to provide Types for the QueryResponseProtocol parameter pack, the compiler just barfs without any error. Xcode 15 and 16.

enum QueryConfigurationFactory {
	static var shipping: QueryConfiguration<ShippingResponse, ListingShippingServiceProperties, PricingResponse> { // where PricingResponse is the first type for the parameter pack
		.init(id: .shipping, serviceHandler: { (properties, requestsState) in
//			let (priceRequestState) = requestsState
//			guard case let .success(value) = priceRequestState else { return nil }
			return nil
//			return ShippingServiceCall(postalCode: properties.postalCode, price: value.price)
		})
	}
}

I'm not even sure if it's possible to do what I'm trying to do here. How can I provide the right Type or hinting to the compiler so it can understand my instance?

The compiler even gives me hints to get to this state, but once I satisfy it's suggestions, it just gives up. Like this should work, but doesn't.