Why doesn't Function2 have an andThen method?
I can't speak as to why Function2
doesn't supply and andThen
, but Scalaz defines Functor
instances for functions of various arities where map
is equivalent to andThen
, meaning you could write
val multiplyAndDouble = multiply map double
I have just noticed it is easy to work around with the following:
val multiplyAndDouble = multiply.tupled andThen double
val res = multiplyAndDouble(1, 3) // res = 6