也许我需要复习依赖类型,但我不明白为什么以下方法不起作用:
trait Code { type In; type Out }
trait Handler[In, Out]
class Foo(val code: Code)(handler: Option[Handler[code.In, code.Out]])
错误:
<console>:52: error: not found: value code
class Foo(val code: Code)(handler: Option[Handler[code.In, code.Out]])
^
<console>:52: error: not found: value code
class Foo(val code: Code)(handler: Option[Handler[code.In, code.Out]])
^
编辑 : 我现在可以看到如何解决这个问题了。我仍然想知道为什么上述方法不起作用?
最佳答案
另一种解决方法:
trait Foo {
val code: Code
val handler: Handler[code.In, code.Out]
}
关于scala - 找不到路径相关类型的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24207625/