1

What's the difference between the two definitions?

def f[F[_]: Async](...) = ???

def f[F[_]](...)(implicit F: Async[F]) = ???

later I can use Async[F].async {} in first case and F.async {} in second But i can't figure out the difference. Thx.

Dmytro Mitin
  • 37,305
  • 2
  • 20
  • 53
cr4zsci
  • 11
  • 3

1 Answers1

1

I would say, it is just a matter of personal preference.

One is a syntactic sugar to other, You can go with any one of them and achieve same thing.

Note that, you are able to use this Async[F].async {} just because someone already defined apply method which looks similar to your second option.

If that was not the case, then you had to write it like implicitly[Async[F]].async {}

Pritam Kadam
  • 2,260
  • 7
  • 14