Created
May 16, 2018 09:24
-
-
Save bandrzejczak/714e6db01f561bfac05d399e96edfda1 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
// F[G[_]] ~> H[_] | |
type MapNestedK[F[_], G[_], H[_]] = FunctionK[λ[a => F[G[a]]], H] | |
// This compiles | |
implicit def flatten[F[_]](implicit F: FlatMap[F]): MapNestedK[F, F, F] = | |
λ[λ[a => F[F[a]]] ~> F](F.flatten(_)) | |
// But for some reason this doesn't | |
implicit def flatten[F[_]](implicit F: FlatMap[F]): MapNestedK[F, F, F] = | |
λ[MapNestedK[F, F, F]](F.flatten(_)) | |
// Even though explicit instance creating works | |
implicit def flatten[F[_]](implicit F: FlatMap[F]): MapNestedK[F, F, F] = | |
new MapNestedK[F, F, F] { | |
override def apply[A](fa: F[F[A]]): F[A] = F.flatten(fa) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The error I get is
not found: value λ