How is the Partially-Applied Type used in this case Task.Create?

37 views Asked by At

I see this code in monix repo, under the object Task that uses the Partially applied technique. I understand that the technique is used when we want to infer 1 type parameter at a time in a case where inferring both would be impossible, right. Why is it used here?

private[eval] final class CreatePartiallyApplied[A](val dummy: Boolean = true) extends AnyVal {
      def apply[CancelationToken](register: (Scheduler, Callback[Throwable, A]) => CancelationToken)(
        implicit B: AsyncBuilder[CancelationToken]): Task[A] =
        B.create(register)
    }


def create[A]: AsyncBuilder.CreatePartiallyApplied[A] = new AsyncBuilder.CreatePartiallyApplied[A]
0

There are 0 answers