Scala extends double arrow

后端 未结 1 861
我在风中等你
我在风中等你 2021-01-21 03:28

I was looking at the Anorm source code and for the RowParser trait it has the declaration:

trait RowParser[+A] extends (Row => SqlResult[A]) { ... }


        
相关标签:
1条回答
  • 2021-01-21 03:58

    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.

    0 讨论(0)
提交回复
热议问题