为什么 boost::hana::experimental::types 是一项实验性功能?类型列表有什么棘手之处?

Why is boost::hana::experimental::types an experimental feature? what is tricky about a list of types?

我正在研究 Hana and I was surprised to see that it has a concept of a type (a "container of types" of sort, something like a one-element tuple with no actual value), but typestype 的序列)是一项实验性功能。

有谁知道为什么?与单一类型的容器相比,类型列表有何复杂之处?

答案基本上就是Jason说的:

I'd like to see types as a hana::Sequence but it wouldn't pass the laws as it won't hold any kind of value (like values with run-time state).

"problem" 是 hana::types 不能变成 hana::Sequence,因为 hana::Sequence 应该可以容纳任意的东西,而不仅仅是类型.虽然这看起来可能没什么大不了的,但实际上确实如此。例如,我们也无法满足 hana::Monad,因为这需要 hana::flatten,其签名是 M<M<T>> -> M<T> 任意 hana::Monad M。由于 hana::types 只能容纳类型,因此您不能拥有例如hana::types<hana::types<int, char>, hana::types<float, long>> 整个东西没有特殊外壳。

无论解决方案是什么,我都想找到一个不会破坏 Hana 概念完整性的解决方案,同时仍然允许编译时效率更高的类型列表。