Adjunction

abstract
class Adjunction[F[_], G[_]](implicit val F: Functor[F], val G: Functor[G])

An adjunction formed by two functors F and G such that F is left-adjoint to G. The composite functor GF is a monad and the composite functor FG is a comonad.

The minimal definition is either (unit, counit) or (leftAdjunct, rightAdjunct)

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def compose[P[_], Q[_]](implicit A: Adjunction[P, Q]): Adjunction[[α] =>> P[F[α]], [α] =>> G[Q[α]]]

Adjunctions compose in a natural fashion. If F -| G is an adjunction, and P -| Q is an adjunction, then PF -| GQ is an adjunction. In fact, adjunctions in Scala form a monoid.

Adjunctions compose in a natural fashion. If F -| G is an adjunction, and P -| Q is an adjunction, then PF -| GQ is an adjunction. In fact, adjunctions in Scala form a monoid.

def counit[A](a: F[G[A]]): A

Extracts a value out of the comonad.

Extracts a value out of the comonad.

def leftAdjunct[A, B](a: => A)(f: F[A] => B): G[B]

Every F-algebra maps to a G-coalgebra.

Every F-algebra maps to a G-coalgebra.

def rightAdjunct[A, B](a: F[A])(f: A => G[B]): B

Every G-coalgebra maps to an F-algebra.

Every G-coalgebra maps to an F-algebra.

def unit[A](a: => A): G[F[A]]

Puts a value into the monad.

Puts a value into the monad.

Implicits

Implicits

implicit
val F: Functor[F]
implicit
val G: Functor[G]
implicit
val comonad: Comonad[[α] =>> F[G[α]]]

Every adjunction gives rise to a comonad.

Every adjunction gives rise to a comonad.

implicit
val monad: Monad[[α] =>> G[F[α]]]

Every adjunction gives rise to a monad.

Every adjunction gives rise to a monad.

implicit

Every adjunction is representable.

Every adjunction is representable.

implicit
val zapFG: Zap[F, G]

Adjoint functors annihilate each other.

Adjoint functors annihilate each other.

implicit
val zapGF: Zap[G, F]

Adjoint functors annihilate each other.

Adjoint functors annihilate each other.