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
// unfortunately | |
// opaque type Fix[F[_]] = F[Fix[F]] | |
// won't work (no recursion in opaque type), but this implementation is safe, but scary due to asInstanceOf | |
object FixImpl { | |
type Fix[F[_]] | |
inline def fix[F[_]](f: F[Fix[F]]): Fix[F] = f.asInstanceOf[Fix[F]] | |
inline def unfix[F[_]](f: Fix[F]): F[Fix[F]] = f.asInstanceOf[F[Fix[F]]] | |
} |