And typeclasses in Haskell as well.
I'm not an expert in Rust or Haskell, though, so I welcome corrections.
I'm not sure exactly what you mean, but my naive interpretation is that you can:
Prelude> :t map show
map show :: Show a => [a] -> [String] data Showable = forall a. Show a => Showable a
This allows for [Showable 1, Showable "foo", Showable 'x']
(It requires the ExistentialQuantification language feature.)Which seems to me to be effectively the same as `Barrable` in this case, although it's more generic.
Which is exactly what you said in the first place!
> So you can have a list of Box<Show> in Rust, but you can't have a list of Show in Haskell.
But isn't this comparing two different things? You can't have a list of trait/typeclass in either language (excuse the pseudo-syntax):
Rust: [Bar]
Haskell: [Bar a => a]
But you can (with some extensions in Haskell) have: Rust: [Box<Bar>]
Haskell: [Box Bar]The difference being that in your code you can only put in a single type at a time, eg [Int] or [String], but not both Int and String under the common Show interface type.