Skip to content

Latest commit

 

History

History
81 lines (67 loc) · 7.83 KB

Adjunction.MD

File metadata and controls

81 lines (67 loc) · 7.83 KB

Representable & Adjunctions

Representable

// TODO Haskell extends Distrivutive, Scalaz require F to be Functor
trait Representable[F[_], Rep] {
  def tabulate[X](f: Rep => X): F[X]
  def index[X](fx: F[X])(f: Rep): X
}

Corepresentable

Adjunction

Adjunction[F,B] spacify relation between two Functors (There is natural transformation between composition of those two functors and identity.) We say that F is left adjoint to G.

trait Adjunction[F[_], G[_]] {
  def left[A, B](f: F[A] => B): A => G[B]
  def right[A, B](f: A => G[B]): F[A] => B
}

Adjunction can be defined between Reader monad and Coreader comonad.

Adjoint Triples