-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reverts #21466, but keeps the other changes in that PR and in the abandoned attempt that is #22031. Fixes #21981, by virtue of reverting.
- Loading branch information
Showing
7 changed files
with
236 additions
and
137 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
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
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
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 Ops[F[_], A]: | ||
def map0[B](f0: A => B): F[B] = ??? | ||
|
||
trait Functor1[G[_]] | ||
|
||
trait Functor2[H[_]] | ||
|
||
trait Ref[I[_], +E] | ||
|
||
class Test: | ||
given [J[_]](using J: Functor1[J]): Functor2[J] with | ||
extension [K1, K2](jk: J[(K1, K2)]) | ||
def map2[L](f2: (K1, K2) => L): J[L] = ??? | ||
|
||
def t1[ | ||
M[_[t]], | ||
N[_], | ||
](using N: Functor1[N]): Unit = | ||
|
||
val x3: Ops[N, M[[t] =>> Ref[N, t]]] = ??? | ||
|
||
val x2: N[(M[N], M[[t] =>> Ref[N, t]])] = x3 | ||
.map0 { refs => (???, refs) } | ||
.map2 { case (not, refs) => (???, refs) } |
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,27 @@ | ||
case class Inv[T](x: T) | ||
class Contra[-ContraParam](x: ContraParam) | ||
|
||
trait Ops[F[_], A]: | ||
def map0[B](f0: A => Contra[B]): F[B] = ??? | ||
|
||
trait Functor1[G[_]] | ||
|
||
trait Functor2[H[_]] | ||
|
||
trait Ref[I[_], +E] | ||
|
||
class Test: | ||
given [J[_]](using J: Functor1[J]): Functor2[J] with | ||
extension [K](jk: J[Contra[K]]) | ||
def map2[L](f2: K => L): J[L] = ??? | ||
|
||
def t1[ | ||
M[_[t]], | ||
N[_], | ||
](using N: Functor1[N]): Unit = | ||
|
||
val x3: Ops[N, M[[t] =>> Ref[N, t]]] = ??? | ||
|
||
val x2: N[(M[N], M[[t] =>> Ref[N, t]])] = x3 | ||
.map0 { refs => Contra[Contra[(Nothing, M[[t] =>> Ref[N, t]])]](???) } | ||
.map2 { case (not, refs) => (???, refs) } |
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,29 @@ | ||
object internal: | ||
trait Functor[F[_]] { | ||
extension [T](ft: F[T]) def map[T1](f: T => T1): F[T1] | ||
} | ||
|
||
object cats: | ||
trait Functor[F[_]] | ||
object Functor: | ||
trait Ops[F[_], A]: | ||
def map[B](f: A => B): F[B] = ??? | ||
def toAllFunctorOps[F[_], A](target: F[A])(using Functor[F]): Ops[F, A] = ??? | ||
|
||
given [F[_]](using cf: cats.Functor[F]): internal.Functor[F] with { | ||
extension [T](ft: F[T]) def map[T1](f: T => T1): F[T1] = ??? | ||
} | ||
|
||
trait Ref[F[_], +T] | ||
class MemoizingEvaluator[Input[_[_]], Output[_[_]], F[_]: cats.Functor] { | ||
type OptionRef[T] = Ref[F, Option[T]] | ||
|
||
def sequence[CaseClass[_[_]], G[_], H[_]](instance: CaseClass[[t] =>> G[H[t]]]): G[CaseClass[H]] = ??? | ||
def collectValues(input: Input[F]): F[(Input[F], Input[OptionRef])] = { | ||
val refsF: Input[[t] =>> F[OptionRef[t]]] = ??? | ||
for { | ||
refs <- cats.Functor.toAllFunctorOps(sequence[Input, F, OptionRef](refsF)) | ||
updating = ??? | ||
} yield (updating, refs) | ||
} | ||
} |
Oops, something went wrong.