无形 zipWithKeys:找不到隐式参数

Shapeless zipWithKeys: Could not find implicit parameter

我最近一直在玩 shapeless。有一件非常基本的事情我无法理解:

import shapeless._
import syntax.singleton._
import record._

object NotWorking {
  val result = ("value" :: HNil).zipWithKeys("key" :: HNil)
} 

我希望这个片段输出一个可扩展的记录。但是编译器无法找到 withKeys:

的隐式
could not find implicit value for parameter withKeys: shapeless.ops.hlist.ZipWithKeys[shapeless.::[String,shapeless.HNil],shapeless.::[String,shapeless.HNil]]
[error]     ("value" :: HNil).zipWithKeys("key" :: HNil)

更令人困惑的是,我从 Shapeless 的测试用例中获取的示例非常完美:

import shapeless._
import syntax.singleton._
import record._

object ShamelesslyStolenFromTests {
  val orig =
    ("intField" ->> 1) ::
    ("boolField" ->> true) ::
    HNil

  val result = orig.values.zipWithKeys(orig.keys)
}

我错过了什么?

编译以下代码:

  import shapeless._
  import syntax.singleton._
  import record._

  object FinallyWorking {
    val result = ("value" :: HNil).zipWithKeys[Witness.`"key"`.T :: HNil]("key".narrow :: HNil)
  }

看来这是方法类型参数类型推断的问题。