Interesting problem!

Variants _are_ basically sum types in Nim.

Yeah, I was wondering similar things for some projects.

I am not sure what are you using hlists for, is it an AST. To represent an AST 
you don't really need anything more complicated than data types(variants) in 
Nim: HList.Cons can contain HValue which is a different data type. HValue can 
be this heterogen cell.

I'd also use directly a seq of children instead of head:tail, but this is not 
too important: maybe you need it for your case

I am also not sure if you need to hold the handler inside the cell: typicall 
one defines a fun which handles each kind of variant and handles them with a 
case(or maybe pattern matching) inside (and you can also just dispatch them to 
other functions gen(value: HValue) to to e.g. gen<KindName>(value..))

Again, if you can give a better example of your usecase it would help, but I 
doubt you need concepts/existential types

Reply via email to