问题
I was looking at the Anorm source code and for the RowParser trait it has the declaration:
trait RowParser[+A] extends (Row => SqlResult[A]) { ... }
I was curious what type (Row => SqlResult[A])
is? I haven't been able to find an explanation of the syntax anywhere.
回答1:
This is syntactic sugar for Function1
which is the same as this:
trait RowParser[+A] extends Function1[Row, SqlResult[A]]
If you look further in the Anorm source you'll see that when the trait is implemented it has to define an apply
function since it's implementing the Function1 trait.
来源:https://stackoverflow.com/questions/17434896/scala-extends-double-arrow