Reading Advanced Scala With Cats I can see this line on page 60:
fa.map(g(f(_))) == fa.map(f).map(g)
I'm trying to do something like:
val l = List(1, 2, 3)
def g(v: Int) = v + 1
def f(v: Int) = v * 2
l.map(g(f(_)))
And I'm getting this error:
Error:(25, 12) type mismatch;
found : Int => Int
required: Int
l.map(g(f(_)))
This is okay:
l.map(x => g(f(x)))
l.map(g(_))
Can't understand why my example doesn't work, but in the book it is correct.