data-category-0.7.1: Category theory

LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Category.CartesianClosed

Description

 
Synopsis

Documentation

class (HasTerminalObject k, HasBinaryProducts k) => CartesianClosed k where Source #

A category is cartesian closed if it has all products and exponentials for all objects.

Associated Types

type Exponential k y z :: * Source #

Methods

apply :: Obj k y -> Obj k z -> k (BinaryProduct k (Exponential k y z) y) z Source #

tuple :: Obj k y -> Obj k z -> k z (Exponential k y (BinaryProduct k z y)) Source #

(^^^) :: k z1 z2 -> k y2 y1 -> k (Exponential k y1 z1) (Exponential k y2 z2) Source #

Instances
CartesianClosed Cat Source #

Exponentials in Cat are the functor categories.

Instance details

Defined in Data.Category.CartesianClosed

Associated Types

type Exponential Cat y z :: Type Source #

Methods

apply :: Obj Cat y -> Obj Cat z -> Cat (BinaryProduct Cat (Exponential Cat y z) y) z Source #

tuple :: Obj Cat y -> Obj Cat z -> Cat z (Exponential Cat y (BinaryProduct Cat z y)) Source #

(^^^) :: Cat z1 z2 -> Cat y2 y1 -> Cat (Exponential Cat y1 z1) (Exponential Cat y2 z2) Source #

CartesianClosed Unit Source # 
Instance details

Defined in Data.Category.CartesianClosed

Associated Types

type Exponential Unit y z :: Type Source #

Methods

apply :: Obj Unit y -> Obj Unit z -> Unit (BinaryProduct Unit (Exponential Unit y z) y) z Source #

tuple :: Obj Unit y -> Obj Unit z -> Unit z (Exponential Unit y (BinaryProduct Unit z y)) Source #

(^^^) :: Unit z1 z2 -> Unit y2 y1 -> Unit (Exponential Unit y1 z1) (Exponential Unit y2 z2) Source #

CartesianClosed Boolean Source #

Implication makes the Boolean category cartesian closed.

Instance details

Defined in Data.Category.Boolean

Associated Types

type Exponential Boolean y z :: Type Source #

Category k => CartesianClosed (Presheaves k) Source #

The category of presheaves on a category C is cartesian closed for any C.

Instance details

Defined in Data.Category.CartesianClosed

Associated Types

type Exponential (Presheaves k) y z :: Type Source #

CartesianClosed (f (Fix f)) => CartesianClosed (Fix f) Source # 
Instance details

Defined in Data.Category.Fix

Associated Types

type Exponential (Fix f) y z :: Type Source #

Methods

apply :: Obj (Fix f) y -> Obj (Fix f) z -> Fix f (BinaryProduct (Fix f) (Exponential (Fix f) y z) y) z Source #

tuple :: Obj (Fix f) y -> Obj (Fix f) z -> Fix f z (Exponential (Fix f) y (BinaryProduct (Fix f) z y)) Source #

(^^^) :: Fix f z1 z2 -> Fix f y2 y1 -> Fix f (Exponential (Fix f) y1 z1) (Exponential (Fix f) y2 z2) Source #

CartesianClosed ((->) :: Type -> Type -> Type) Source #

Exponentials in Hask are functions.

Instance details

Defined in Data.Category.CartesianClosed

Associated Types

type Exponential (->) y z :: Type Source #

Methods

apply :: Obj (->) y -> Obj (->) z -> BinaryProduct (->) (Exponential (->) y z) y -> z Source #

tuple :: Obj (->) y -> Obj (->) z -> z -> Exponential (->) y (BinaryProduct (->) z y) Source #

(^^^) :: (z1 -> z2) -> (y2 -> y1) -> Exponential (->) y1 z1 -> Exponential (->) y2 z2 Source #

data ExpFunctor (k :: * -> * -> *) Source #

Constructors

ExpFunctor 
Instances
CartesianClosed k => Functor (ExpFunctor k) Source #

The exponential as a bifunctor.

Instance details

Defined in Data.Category.CartesianClosed

Associated Types

type Dom (ExpFunctor k) :: Type -> Type -> Type Source #

type Cod (ExpFunctor k) :: Type -> Type -> Type Source #

type (ExpFunctor k) :% a :: Type Source #

Methods

(%) :: ExpFunctor k -> Dom (ExpFunctor k) a b -> Cod (ExpFunctor k) (ExpFunctor k :% a) (ExpFunctor k :% b) Source #

type Dom (ExpFunctor k) Source # 
Instance details

Defined in Data.Category.CartesianClosed

type Dom (ExpFunctor k) = Op k :**: k
type Cod (ExpFunctor k) Source # 
Instance details

Defined in Data.Category.CartesianClosed

type Cod (ExpFunctor k) = k
type (ExpFunctor k) :% (y, z) Source # 
Instance details

Defined in Data.Category.CartesianClosed

type (ExpFunctor k) :% (y, z) = Exponential k y z

flip :: CartesianClosed k => Obj k a -> Obj k b -> Obj k c -> k (Exponential k a (Exponential k b c)) (Exponential k b (Exponential k a c)) Source #

curryAdj :: CartesianClosed k => Obj k y -> Adjunction k k (ProductFunctor k :.: Tuple2 k k y) (ExpFunctor k :.: Tuple1 (Op k) k y) Source #

The product functor is left adjoint the the exponential functor.

curry :: CartesianClosed k => Obj k x -> Obj k y -> Obj k z -> k (BinaryProduct k x y) z -> k x (Exponential k y z) Source #

From the adjunction between the product functor and the exponential functor we get the curry and uncurry functions, generalized to any cartesian closed category.

uncurry :: CartesianClosed k => Obj k x -> Obj k y -> Obj k z -> k x (Exponential k y z) -> k (BinaryProduct k x y) z Source #

type State k s a = Exponential k s (BinaryProduct k a s) Source #

From every adjunction we get a monad, in this case the State monad.

stateMonadReturn :: CartesianClosed k => Obj k s -> Obj k a -> k a (State k s a) Source #

stateMonadJoin :: CartesianClosed k => Obj k s -> Obj k a -> k (State k s (State k s a)) (State k s a) Source #

type Context k s a = BinaryProduct k (Exponential k s a) s Source #

contextComonadExtract :: CartesianClosed k => Obj k s -> Obj k a -> k (Context k s a) a Source #

contextComonadDuplicate :: CartesianClosed k => Obj k s -> Obj k a -> k (Context k s a) (Context k s (Context k s a)) Source #