Is there infrastructure in shapeless that takes a type constructor to the power of a Nat?

五迷三道 提交于 2019-12-07 18:40:06

问题


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

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]]
...

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


回答1:


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.



来源:https://stackoverflow.com/questions/42410653/is-there-infrastructure-in-shapeless-that-takes-a-type-constructor-to-the-power

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!