I'm trying to write a function that can take any tagless final trait and return F[String].
def apply[Api[F[_]]](implementation: Api[F[_]]): F[String] = ???
I don't understand why the above is not compiling.
The following works.
trait Api[F[_]]
def apply[F[_]](implementation: Api[F[_]]): F[String] = ???
But how can I get rid of this trait?
Try
When you write
apply[Api[F[_]]](..)you don't declareApiandF, you declare onlyApi. ThereFdoesn't matter, you can writeapply[Api[F[_]]](..)orapply[Api[G[_]]](..)or justapply[Api[_[_]]](..), anyway you can't useFoutside.Api[F[_]]is correct syntax in declaration of type parameter, in type application in type position you should writeApi[F].