【发布时间】:2013-03-14 17:58:40
【问题描述】:
在 Scala REPL 中可以找到值类型:
scala> val x = 1
x: Int = 1
scala> :t x
Int
然而 Scala REPL 不显示函数的类型信息:
scala> def inc(x:Int) = x + 1
inc: (x: Int)Int
scala> :t inc
<console>:9: error: missing arguments for method inc;
follow this method with `_' if you want to treat it as a partially applied function
inc
^
<console>:9: error: missing arguments for method inc;
follow this method with `_' if you want to treat it as a partially applied function
inc
^
如何在 Scala REPL 中查找函数类型?
【问题讨论】:
-
按照错误信息中所说的去做怎么样?
-
this的可能重复
标签: function scala types read-eval-print-loop