HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleadjunctions-4.4.4Haskell2010

Data.Functor.Adjunction

Synopsis
  • Packageadjunctions-4.4.4
  • Exports15
  • LanguageHaskell2010
  • LicenceBSD-2-Clause
  • SourceAdjunction.hs
classclass (Functor f, Representable u) => Adjunction (f :: Type -> Type) (u :: Type -> Type) | f -> u, u -> f where

An adjunction between Hask and Hask.

Minimal definition: both unit and counit or both leftAdjunct and rightAdjunct, subject to the constraints imposed by the default definitions that the following laws should hold.

unit = leftAdjunct id
counit = rightAdjunct id
leftAdjunct f = fmap f . unit
rightAdjunct f = counit . fmap f

Any implementation is required to ensure that leftAdjunct and rightAdjunct witness an isomorphism from Nat (f a, b) to Nat (a, g b)

rightAdjunct unit = id
leftAdjunct counit = id

Methods

Instances13Adjunction, …
valuetabulateAdjunction :: Adjunction f u => (f () -> b) -> u b

Every right adjoint is representable by its left adjoint applied to a unit element

Use this definition and the primitives in Data.Functor.Representable to meet the requirements of the superclasses of Representable.

valueindexAdjunction :: Adjunction f u => u b -> f a -> b

This definition admits a default definition for the index method of 'Index", one of the superclasses of Representable.

valuezipR :: Adjunction f u => (u a, u b) -> u (a, b)

A right adjoint functor admits an intrinsic notion of zipping

valueunzipR :: Functor u => u (a, b) -> (u a, u b)

Every functor in Haskell permits unzipping