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

ciris.api.package.scala Maven / Gradle / Ivy

There is a newer version: 0.12.1
Show newest version
package ciris

package object api {
  type Id[A] = A

  implicit object Id extends Monad[Id] {
    override def map[A, B](fa: Id[A])(f: A => B): Id[B] = f(fa)
    override def product[A, B](fa: Id[A], fb: Id[B]): Id[(A, B)] = (fa, fb)
    override def pure[A](x: A): Id[A] = x
    override def flatMap[A, B](fa: Id[A])(f: A => Id[B]): Id[B] = f(fa)
  }

  type ~>[F[_], G[_]] = FunctionK[F, G]

  implicit def idFunctionK[G[_]: Applicative]: FunctionK[Id, G] =
    new FunctionK[Id, G] {
      override def apply[A](fa: Id[A]): G[A] =
        Applicative[G].pure(fa)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy