forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
trait Abstract[F[_], A] { | ||
type Out[G[_]] | ||
} | ||
object Abstract { | ||
type Aux[F[_], A, Out0[_[_]]] = Abstract[F, A] { type Out[G[_]] = Out0[G] } | ||
|
||
implicit def valueAbstract[F[_], A]: Aux[F, F[A], [G[_]] =>> G[A]] = new Abstract[F, F[A]] { | ||
type Out[G[_]] = G[A] | ||
} | ||
|
||
implicit def hkdAbstract[F[_], A[_[_]]]: Aux[F, A[F], [G[_]] =>> A[G]] = new Abstract[F, A[F]] { | ||
type Out[G[_]] = A[G] | ||
} | ||
} | ||
|
||
case class StringF[F[_]](s: F[String]) | ||
|
||
trait Q[M[_[_]]] { | ||
def map[A, M2[_[_]]](f: M[Option] => A)(implicit abs: Abstract.Aux[Option, A, M2]): Q[M2] | ||
} | ||
|
||
val q: Q[[F[_]] =>> F[String]] = ??? | ||
val q2 = q.map(s => s) // was an error, now OK | ||
val q3 = q.map(s => StringF(s)) |