[Haskell-cafe] A yet another question about subtyping and heterogeneous collections

Dmitry Vyal akamaus at gmail.com
Fri Oct 19 20:43:31 CEST 2012

> Second, all your examples so far used structural subtyping (objects
> with the same fields have the same type) rather than nominal
> subtyping of C++ (distinct classes have distinct types even if they
> have the same fields; the subtyping must be declared in the class
> declaration). For the structural subtyping, upcasts and downcasts can
> be done mostly automatically. See the OOHaskell paper or the code
Hello Oleg,
I've glanced over both HList and OOHaskell papers when I considered 
taking different approaches. Albeit elegant, OOHaskell looked too heavy 
for my purposes, I don't need mutability, for example. And HList paper 
left me with two questions. The first one is how much such an encoding 
costs both in terms of speed and space. And the second one is can I 
conveniently define a Storable instance for hlists. As I said before, I 
need all this machinery to parse a great number of serialized nested C 
structs from a file.

Best regards

More information about the Haskell-Cafe mailing list