I'm looking to perform a transformation like (in F#):

```ml
type Test = TBool of bool | TString of string

type TestList = TLBool of bool list | TLString of string list

let transform : Map<int, Test> list -> Map<int, TestList> = ??

```

Is there a way to encode this such that we "know" that while the Map contains heterogeneous values, the value at each position is the same type across elements of the containing list? The Maps would be of static size once constructed and the same across each list element, but the size is not known in advance so I'm basically looking to generate tuples/records of an unknown size.

**Edit**

I think my example was unclear. The root of what I'm after is to be able to take two variable sized collections whose values at a given position are always the same type, but that the collection itself can contain values of multiple types, and "zip" them together using the knowledge that at a given position the two values are the same type. Specifically, I don't want to have to recheck that they are the same and propagate the condition that they vary (as an error of some sort), since I already do exactly that when initially creating the collections.

**Edit 2**

From a comment posted below: I do essentially want heterogenous lists (I used maps since my indices can be sparse, but I could always use lists with an index mapping), but with the additional constraint that two instances of the heterogenous list can be "zipped together" and the values at a given index are of the same type.