Interestingly, you can encode the object type in Haskell like so:
{-# LANGUAGE ExistentialQuantification, KindSignatures, ConstraintKinds #-}
import Data.Kind
data Dyn (c :: * -> Constraint) = forall (t :: *). (c t :: Constraint) => D t
heteroList :: [Dyn Show]
heteroList = [D (), D 5, D True]
It might be interesting to add this type to the base
package in Haskell or add some sugar for it; seems to me that Haskell could take a page from Rust here.
PS: Thanks for the fun and interesting discussion; and sorry for the OT on traits