Scala: question marks in type parameters

I am trying to understand the following code fragment (from the Scalaz library):

def kleisliIdApplicative[R]: Applicative[Kleisli[Id, R, ?]] = ...

I assume that the type of the form T[P0, ?]is a constructor type that takes a parameter. However, I cannot find documentation that explains the use of question marks in type parameters.

A related question is what is the difference between a question mark and underscore?

Is there a place where all this is well documented?

+3
source share
1 answer

The question mark syntax comes from a compiler plugin called kind-projector .

, scalaz : https://github.com/scalaz/scalaz/blob/series/7.3.x/project/build.scala#L226

Kleisli[Id, R, ?]

()

({type L[A] = Kleisli[Id, R, A]})#L

(, , Scala) lambda, .. .

+10

Source: https://habr.com/ru/post/1648768/


All Articles