斯卡拉扩展双箭头
问题描述:
我看着它具有声明Anorm source code and for the RowParser
trait:斯卡拉扩展双箭头
trait RowParser[+A] extends (Row => SqlResult[A]) { ... }
我很好奇(Row => SqlResult[A])
是什么类型的?我一直无法找到任何地方的语法解释。
答
这是Function1
语法糖是一样的:
trait RowParser[+A] extends Function1[Row, SqlResult[A]]
如果您在Anorm source进一步看,你会看到,当这种特点就是实现它,因为它是定义一个apply
功能实现Function1特性。
[Scala中的右箭头含义]的可能重复(http://*.com/questions/3878347/right-arrow-meanings-in-scala) –