I'm going through "Scala with cats". In 3.5.2 (p. 58, bottom) there is an example:
def doMath[F[_]](start: F[Int])(implicit functor: Functor[F]): F[Int] =
start.map(n => n + 1 * 2)
And the usage is pretty straightforward:
import cats.instances.option._ // for Functor
import cats.instances.list._
// for Functor
doMath(Option(20))
// res3: Option[Int] = Some(22)
doMath(List(1, 2, 3))
// res4: List[Int] = List(3, 4, 5)
How should I understand the type constructor in the method signature (F[_])? A couple of pages earlier it was said, that the type parameter should be provided to create a type. Here the whole thing (F[_]) is a type parameter and it looks, that _ is a wildcard, so that the compiler can infer the type parameter of F.