Compose and andThen methods

后端 未结 4 416
长情又很酷
长情又很酷 2021-01-30 08:28

I\'m following the tutorial Pattern matching & functional composition on Scala compose and andThen methods. There\'s such an example:

4条回答
  •  借酒劲吻你
    2021-01-30 09:24

    I believe the tutorial was written for an earlier version of Scala (probably 2.7.7 or earlier). There have been some changes in the compiler since then, namely, extensions to the type system, which now cause the type inferencing to fail on the:

    addUhum(_).compose(addAhem(_))
    

    The lifting to a function still works with that syntax if you just write:

    addUhum(_)
    

提交回复
热议问题