Hi everyone,
I am trying create an array of values, where the values are different types.
I am not interested in the concrete types, but really some common interface that
is shared between all the different concrete types. For example, I want an array of
Showable values.
I have read the following posts on SO:
-
https://stackoverflow.com/questions/35990022/how-can-i-create-an-array-with-polymorphic-data-
https://stackoverflow.com/questions/36006483/how-to-use-type-constrains-with-existsbut it is not clear to me how to achieve this. The second URL embeds the `show` function into the value itself,
but what if we have a type class with 7 functions, then I would need to embed all 7 functions into the value itself
which seems like this approach does not scale well.
How can I embed the dictionary of the type class, rather than the individual functions into each value in the Array?
Happy holidays.
Regards
--Rouan