Given a type with with a type parameter is it possible to then create a list containing values with mixed concrete types? See the code below. All works well until I try to create list2 where some elements have an int for data and others have a float. Is there a way to do this? My attempt in list3 does not compile.
type Holder<'data> = {
Data : 'data
Name : String
}
let intVal =
{Data = 23;
Name = "Bill"}
let intVal2 =
{Data = 29;
Name = "Cindy"}
let floatVal =
{Data = 23.0;
Name = "John"}
let list1 = [intVal; intVal2]
let list2 = [intVal; floatVal]
let list3 : Holder<'a> list = [intVal; floatVal]