Hacker News new | ask | show | jobs
by bodhi 4052 days ago
This works on single instances, but I'm trying to see how it plays out with lists of `Bar`. As far as I can see, you need to use `Box`: https://play.rust-lang.org/?code=struct%20Foo%3B%0Astruct%20...

Which seems to me to be effectively the same as `Barrable` in this case, although it's more generic.

1 comments

> As far as I can see, you need to use `Box`

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]