kan-extensions-5.2.7: Kan extensions, Kan lifts, the Yoneda lemma, and (co)density (co)monads

Copyright | (C) 2013-2016 Edward Kmett Gershom Bazerman and Derek Elkins
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | None
Language | Haskell2010

Data.Functor.Contravariant.Day

Description

The Day convolution of two contravariant functors is a contravariant functor.

http://ncatlab.org/nlab/show/Day+convolution

Synopsis

- data Day (f :: Type -> Type) (g :: Type -> Type) a = Day (f b) (g c) (a -> (b, c))
- day :: f a -> g b -> Day f g (a, b)
- runDay :: (Contravariant f, Contravariant g) => Day f g a -> (f a, g a)
- assoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day f (Day g h) a -> Day (Day f g) h a
- disassoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day (Day f g) h a -> Day f (Day g h) a
- swapped :: forall (f :: Type -> Type) (g :: Type -> Type) a. Day f g a -> Day g f a
- intro1 :: f a -> Day (Proxy :: Type -> Type) f a
- intro2 :: f a -> Day f (Proxy :: Type -> Type) a
- day1 :: forall f (g :: Type -> Type) a. Contravariant f => Day f g a -> f a
- day2 :: forall g (f :: Type -> Type) a. Contravariant g => Day f g a -> g a
- diag :: f a -> Day f f a
- trans1 :: forall f g (h :: Type -> Type) a. (forall x. f x -> g x) -> Day f h a -> Day g h a
- trans2 :: forall g h (f :: Type -> Type) a. (forall x. g x -> h x) -> Day f g a -> Day f h a

# Documentation

data Day (f :: Type -> Type) (g :: Type -> Type) a Source #

The Day convolution of two contravariant functors.

Constructors

Day (f b) (g c) (a -> (b, c)) |

#### Instances

Instances details

(Representable f, Representable g) => Representable (Day f g) Source # |

Instance details

Defined in Data.Functor.Contravariant.Day

Associated Types

type Rep (Day f g) |
Instance details Defined in Data.Functor.Contravariant.Day type Rep (Day f g) = (Rep f, Rep g)

Methods

tabulate :: (a -> Rep (Day f g)) -> Day f g a Source #

index :: Day f g a -> a -> Rep (Day f g) Source #

contramapWithRep :: (b -> Either a (Rep (Day f g))) -> Day f g a -> Day f g b Source #

Contravariant (Day f g) Source # |
Instance details Defined in Data.Functor.Contravariant.Day Methods contramap :: (a' -> a) -> Day f g a -> Day f g a' Source # (>$) :: b -> Day f g b -> Day f g a Source #
(Divisible f, Divisible g) => Divisible (Day f g) Source # |
Instance details Defined in Data.Functor.Contravariant.Day Methods divide :: (a -> (b, c)) -> Day f g b -> Day f g c -> Day f g a Source # conquer :: Day f g a Source #
(Adjunction f u, Adjunction f' u') => Adjunction (Day f f') (Day u u') Source # |
Instance details Defined in Data.Functor.Contravariant.Day Methods unit :: a -> Day u u' (Day f f' a) Source # counit :: a -> Day f f' (Day u u' a) Source # leftAdjunct :: (b -> Day f f' a) -> a -> Day u u' b Source # rightAdjunct :: (a -> Day u u' b) -> b -> Day f f' a Source #
type Rep (Day f g) Source # |
Instance details Defined in Data.Functor.Contravariant.Day type Rep (Day f g) = (Rep f, Rep g)

day :: f a -> g b -> Day f g (a, b) Source #

Construct the Day convolution

    day1 (day f g) = f
    day2 (day f g) = g

runDay :: (Contravariant f, Contravariant g) => Day f g a -> (f a, g a) Source #

Break apart the Day convolution of two contravariant functors.

assoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day f (Day g h) a -> Day (Day f g) h a Source #

Day convolution provides a monoidal product. The associativity of this monoid is witnessed by `assoc` and `disassoc`.

    assoc . disassoc = id
    disassoc . assoc = id
    contramap f . assoc = assoc . contramap f

disassoc :: forall (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) a. Day (Day f g) h a -> Day f (Day g h) a Source #

Day convolution provides a monoidal product. The associativity of this monoid is witnessed by `assoc` and `disassoc`.

    assoc . disassoc = id
    disassoc . assoc = id
    contramap f . disassoc = disassoc . contramap f

swapped :: forall (f :: Type -> Type) (g :: Type -> Type) a. Day f g a -> Day g f a Source #

The monoid for Day convolution in Haskell is symmetric.

    contramap f . swapped = swapped . contramap f

intro1 :: f a -> Day (Proxy :: Type -> Type) f a Source #

Proxy serves as the unit of Day convolution.

    day1 . intro1 = id
    contramap f . intro1 = intro1 . contramap f

intro2 :: f a -> Day f (Proxy :: Type -> Type) a Source #

Proxy serves as the unit of Day convolution.

    day2 . intro2 = id
    contramap f . intro2 = intro2 . contramap f

day1 :: forall f (g :: Type -> Type) a. Contravariant f => Day f g a -> f a Source #

In Haskell we can do general purpose elimination, but in a more general setting it is only possible to eliminate the unit.

    day1 . intro1 = id
    day1 = fst . runDay
    contramap f . day1 = day1 . contramap f

day2 :: forall g (f :: Type -> Type) a. Contravariant g => Day f g a -> g a Source #

In Haskell we can do general purpose elimination, but in a more general setting it is only possible to eliminate the unit. ``day2` `.` `intro2` = `id` `day2` = `snd` `.` `runDay` `contramap` f `.` `day2` = `day2` `.` `contramap` f`

diag :: f a -> Day f f a Source #

Diagonalize the Day convolution:

    day1 . diag = id
    day2 . diag = id
    runDay . diag = a -> (a,a)
    contramap f . diag = diag . contramap f

trans1 :: forall f g (h :: Type -> Type) a. (forall x. f x -> g x) -> Day f h a -> Day g h a Source #

Apply a natural transformation to the left-hand side of a Day convolution.

This respects the naturality of the natural transformation you supplied:

    contramap f . trans1 fg = trans1 fg . contramap f

trans2 :: forall g h (f :: Type -> Type) a. (forall x. g x -> h x) -> Day f g a -> Day f h a Source #

Apply a natural transformation to the right-hand side of a Day convolution.

This respects the naturality of the natural transformation you supplied:

    contramap f . trans2 fg = trans2 fg . contramap f