How to compose to methods, without duplicate input arguments

后端 未结 2 1163
遥遥无期
遥遥无期 2021-01-05 10:08

Suppose I have two methods

scala> def a(a: Int, b: Int, c: Int) : Int = …
a: (a: Int, b: Int, c: Int)Int

scala> def b(i: Int) : Int = …
b: (i: Int)Int         


        
2条回答
  •  半阙折子戏
    2021-01-05 10:53

    Scalaz defines Functor instances for higher-arity functions, so you can just write

    (a _).map(b)
    

提交回复
热议问题