-
-
Save Katrix/81f27774cf49de86b40391610b0a0902 to your computer and use it in GitHub Desktop.
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
object Minified { | |
trait Inspect[F[_[_]], In] { | |
type Out | |
} | |
object Inspect { | |
type Aux[F[_[_]], In, Out0] = Inspect[F, In] { | |
type Out = Out0 | |
} | |
def apply[F[_[_]], In]( | |
implicit findReplace: Inspect[F, In] | |
): Aux[F, In, findReplace.Out] = findReplace | |
implicit def valueTypes[F[_[_]], W[_]]: Inspect.Aux[F, F[W], W[Int]] = | |
new Inspect[F, F[W]] { | |
type Out = W[Int] | |
} | |
} | |
object Inspect2 { | |
def apply[F[_[_]], In] = new PartiallyApplied[F, In] | |
class PartiallyApplied[F[_[_]], In] { | |
def check[W[_]](implicit ev: In =:= F[W]): Int = 0 | |
} | |
} | |
type F2[W[_]] = W[W[Int]] | |
//Doesn't work | |
Inspect[F2, Option[Option[Int]]] | |
//Works | |
Inspect2[F2, Option[Option[Int]]].check | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment