本文介绍了无形中是否有将类型构造函数用于 Nat 的基础结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

对我来说,这似乎是一个非常基本的功能,但我在当前的 shapeless (2.3.3) 中找不到它.

To me this appears as a very basic functionality, but I can't find it in current shapeless (2.3.3).

所以我正在寻找一个类型 Induction[X,F[_],N <: Nat] with

So I am looking for a type Induction[X,F[_],N <: Nat] with

Induction[X,F,Nat._0].Out =:= X
Induction[X,F,Nat._1].Out =:= F[X]
Induction[X,F,Nat._2].Out =:= F[F[X]]
...

也许也可以沿着类型构造链接一个函数,例如,构造一个 Point 实例?

Maybe it's also possible to chain a function along the type construction, e.g., to construct a Point instance?

推荐答案

不,没有.正如您所观察到的,这很可能需要一个类似 Point 的类型类才能有用.我建议在 Kittens 中添加类似的内容,这取决于无形和猫.

No there isn't. As you observe this most likely needs a Point-like type class to be useful. I suggest adding something like this to Kittens which depends on both shapeless and Cats.

这篇关于无形中是否有将类型构造函数用于 Nat 的基础结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 10:17