higherkindness.droste.data.Fix.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of droste-core_sjs1_2.12 Show documentation
Show all versions of droste-core_sjs1_2.12 Show documentation
recursion schemes for cats; to iterate is human, to recurse, divine
The newest version!
package higherkindness.droste
package data
import meta.Meta
object Fix {
def apply[F[_]](f: F[Fix[F]]): Fix[F] = macro Meta.fastCast
def un[F[_]](f: Fix[F]): F[Fix[F]] = macro Meta.fastCast
def unapply[F[_]](f: Fix[F]): Some[F[Fix[F]]] = Some(un(f))
def algebra[F[_]]: Algebra[F, Fix[F]] = Algebra(apply(_))
def coalgebra[F[_]]: Coalgebra[F, Fix[F]] = Coalgebra(un(_))
}