All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tofu.syntax.functionK.scala Maven / Gradle / Ivy

There is a newer version: 0.9.2
Show newest version
package tofu.syntax

import cats.~>

object functionK {
  /** simple constructor of FunctionK
    * you can use it as makeFunctionK[List, Option](_.headOption)
    * credits : https://github.com/alexknvl*/
  def makeFunctionK[F[_], G[_]](maker: MakeFunctionK[F, G]): F ~> G = maker

  abstract class MakeFunctionK[F[_], G[_]] extends (F ~> G) {

    def applyArbitrary(f: F[Arbitrary]): G[Arbitrary]

    def apply[A](fa: F[A]): G[A] = applyArbitrary(fa.asInstanceOf[F[Arbitrary]]).asInstanceOf[G[A]]
  }
  type Arbitrary
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy