Created
August 11, 2017 01:04
-
-
Save edmundnoble/8f4c5de06ed0f14438f3295f1408a74c 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
trait FixT { | |
type T[_[_]] | |
def subst[F[_[_[_]]]](kt: F[T]): F[λ[k[_] => k[T[k]]]] | |
def unsubst[F[_[_[_]]]](kt: F[λ[k[_] => k[T[k]]]]): F[T] | |
} | |
package object matryoshka { | |
val FixI: FixT = new FixT { | |
type T[F[_]] = Fix[F] | |
def subst[F[_[_[_]]]](kt: F[T]): F[λ[k[_] => k[T[k]]]] = kt | |
def unsubst[F[_[_[_]]]](kt: F[λ[k[_] => k[T[k]]]]): F[T] = kt | |
def unwrap[F[_]](f: T[F]): F[T[F]] = subst[λ[τ[_[_]] => τ[F]]](f) | |
def wrap[F[_]](f: F[T[F]]): T[F] = unsubst[λ[τ[_[_]] => τ[F]]](f) | |
} | |
type Fix[F[_]] = FixI.T[F] | |
} |
Author
edmundnoble
commented
Aug 11, 2017
•
[error] ^
[error] /Users/edmund/workspace/scala/matryoshka/core/shared/src/main/scala/matryoshka/package.scala:194: type mismatch;
[error] found : kt.type (with underlying type F[matryoshka.package.FixI.T])
[error] required: F[[k[_$1]]k[matryoshka.package.FixI.T[k]]]
[error] def subst[F[_[_[_]]]](kt: F[FixI.T]): F[λ[k[_] => k[FixI.T[k]]]] = kt
[error] ^
[error] /Users/edmund/workspace/scala/matryoshka/core/shared/src/main/scala/matryoshka/package.scala:195: type mismatch;
[error] found : kt.type (with underlying type F[[k[_$2]]k[matryoshka.package.FixI.T[k]]])
[error] required: F[matryoshka.package.FixI.T]
[error] def unsubst[F[_[_[_]]]](kt: F[λ[k[_] => k[FixI.T[k]]]]): F[FixI.T] = kt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment