@andrea your HList/hkCons's tail has type T which means you can't be sure that 
it's a HCons - you'll lose the generic type information too and can't apply 
type inference anymore.

@mratsim my lists are always heterogeneous

@alehander42 let me explain the problem:

I'm trying to create a flexible and easy-to-use 
[msgpack]([https://msgpack.org/](https://msgpack.org/)) library(also see the 
[spec]([https://github.com/msgpack/msgpack/blob/master/spec.md#formats](https://github.com/msgpack/msgpack/blob/master/spec.md#formats))
 and [neovim rpc 
client]([https://neovim.io/doc/user/msgpack_rpc.html](https://neovim.io/doc/user/msgpack_rpc.html))
 for nim. For example, an RPC message looks like this:
    
    
    @[messageType, messageId, rpc_method, arguments]
    
    
    Run

where 'messageType' is an int8

'messageId' can be anything, I'm using uint64

'rpc_method' is a string

and the 'arguments' is an array of anything - but I can only use the packaging 
methods for certain primitive and custom types([u]intX, string, array, map, 
some custom ranges etc.) - I defined them as overloaded methods: method 
pack*(packet: Packet, dat: ...) = ...

The users should be able to pass any array to a request creator without casting 
and without violating the msgpack and nvim-rpc protocols.

The users can also receive responses and notifications - the values inside can 
be anything.

I'm thinking about creating a buffer holding a sequence of RootObj - BUT only 
exposing addition through typesafe methods - this is similar to my attempt 
defined in my 4. post.

Reply via email to