| License | BSD-style (see the file LICENSE) |
|---|---|
| Maintainer | sjoerd@w3future.com |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Category.CartesianClosed
Description
Synopsis
- class (HasTerminalObject k, HasBinaryProducts k) => CartesianClosed k where
- type Exponential k (y :: Kind k) (z :: Kind k) :: Kind k
- apply :: Obj k y -> Obj k z -> k (BinaryProduct k (Exponential k y z) y) z
- tuple :: Obj k y -> Obj k z -> k z (Exponential k y (BinaryProduct k z y))
- (^^^) :: k z1 z2 -> k y2 y1 -> k (Exponential k y1 z1) (Exponential k y2 z2)
- data ExpFunctor (k :: * -> * -> *) = ExpFunctor
- 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))
- type PShExponential k y z = (Presheaves k :-*: z) :.: Opposite ((ProductFunctor (Presheaves k) :.: Tuple2 (Presheaves k) (Presheaves k) y) :.: YonedaEmbedding k)
- pattern PshExponential :: Category k => Obj (Presheaves k) y -> Obj (Presheaves k) z -> PShExponential k y z
- curryAdj :: CartesianClosed k => Obj k y -> Adjunction k k (ProductFunctor k :.: Tuple2 k k y) (ExpFunctor k :.: Tuple1 (Op k) k y)
- curry :: (CartesianClosed k, Kind k ~ *) => Obj k x -> Obj k y -> Obj k z -> k (BinaryProduct k x y) z -> k x (Exponential k y z)
- uncurry :: (CartesianClosed k, Kind k ~ *) => Obj k x -> Obj k y -> Obj k z -> k x (Exponential k y z) -> k (BinaryProduct k x y) z
- type State k s a = Exponential k s (BinaryProduct k a s)
- stateMonadReturn :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k a (State k s a)
- stateMonadJoin :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k (State k s (State k s a)) (State k s a)
- type Context k s a = BinaryProduct k (Exponential k s a) s
- contextComonadExtract :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k (Context k s a) a
- contextComonadDuplicate :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k (Context k s a) (Context k s (Context k s a))
Documentation
class (HasTerminalObject k, HasBinaryProducts k) => CartesianClosed k where #
A category is cartesian closed if it has all products and exponentials for all objects.
Associated Types
type Exponential k (y :: Kind k) (z :: Kind k) :: Kind k #
Methods
apply :: Obj k y -> Obj k z -> k (BinaryProduct k (Exponential k y z) y) z #
tuple :: Obj k y -> Obj k z -> k z (Exponential k y (BinaryProduct k z y)) #
(^^^) :: k z1 z2 -> k y2 y1 -> k (Exponential k y1 z1) (Exponential k y2 z2) #
Instances
| CartesianClosed Unit # | |
Defined in Data.Category.CartesianClosed Associated Types type Exponential Unit y z :: Kind k # Methods apply :: forall (y :: k) (z :: k). Obj Unit y -> Obj Unit z -> Unit (BinaryProduct Unit (Exponential Unit y z) y) z # tuple :: forall (y :: k) (z :: k). Obj Unit y -> Obj Unit z -> Unit z (Exponential Unit y (BinaryProduct Unit z y)) # (^^^) :: forall (z1 :: k) (z2 :: k) (y2 :: k) (y1 :: k). Unit z1 z2 -> Unit y2 y1 -> Unit (Exponential Unit y1 z1) (Exponential Unit y2 z2) # | |
| CartesianClosed Boolean # | Implication makes the Boolean category cartesian closed. |
Defined in Data.Category.Boolean Associated Types type Exponential Boolean y z :: Kind k # Methods apply :: forall (y :: k) (z :: k). Obj Boolean y -> Obj Boolean z -> Boolean (BinaryProduct Boolean (Exponential Boolean y z) y) z # tuple :: forall (y :: k) (z :: k). Obj Boolean y -> Obj Boolean z -> Boolean z (Exponential Boolean y (BinaryProduct Boolean z y)) # (^^^) :: forall (z1 :: k) (z2 :: k) (y2 :: k) (y1 :: k). Boolean z1 z2 -> Boolean y2 y1 -> Boolean (Exponential Boolean y1 z1) (Exponential Boolean y2 z2) # | |
| Category k => CartesianClosed (Presheaves k :: Type -> Type -> Type) # | The category of presheaves on a category |
Defined in Data.Category.CartesianClosed Associated Types type Exponential (Presheaves k) y z :: Kind k # Methods apply :: forall (y :: k0) (z :: k0). Obj (Presheaves k) y -> Obj (Presheaves k) z -> Presheaves k (BinaryProduct (Presheaves k) (Exponential (Presheaves k) y z) y) z # tuple :: forall (y :: k0) (z :: k0). Obj (Presheaves k) y -> Obj (Presheaves k) z -> Presheaves k z (Exponential (Presheaves k) y (BinaryProduct (Presheaves k) z y)) # (^^^) :: forall (z1 :: k0) (z2 :: k0) (y2 :: k0) (y1 :: k0). Presheaves k z1 z2 -> Presheaves k y2 y1 -> Presheaves k (Exponential (Presheaves k) y1 z1) (Exponential (Presheaves k) y2 z2) # | |
| CartesianClosed (f (Fix f)) => CartesianClosed (Fix f :: Type -> Type -> Type) # |
|
Defined in Data.Category.Fix Associated Types type Exponential (Fix f) y z :: Kind k # Methods apply :: forall (y :: k) (z :: k). Obj (Fix f) y -> Obj (Fix f) z -> Fix f (BinaryProduct (Fix f) (Exponential (Fix f) y z) y) z # tuple :: forall (y :: k) (z :: k). Obj (Fix f) y -> Obj (Fix f) z -> Fix f z (Exponential (Fix f) y (BinaryProduct (Fix f) z y)) # (^^^) :: forall (z1 :: k) (z2 :: k) (y2 :: k) (y1 :: k). Fix f z1 z2 -> Fix f y2 y1 -> Fix f (Exponential (Fix f) y1 z1) (Exponential (Fix f) y2 z2) # | |
| CartesianClosed ((->) :: Type -> Type -> Type) # | Exponentials in |
Defined in Data.Category.CartesianClosed Associated Types type Exponential (->) y z :: Kind k # Methods apply :: forall (y :: k) (z :: k). Obj (->) y -> Obj (->) z -> BinaryProduct (->) (Exponential (->) y z) y -> z # tuple :: forall (y :: k) (z :: k). Obj (->) y -> Obj (->) z -> z -> Exponential (->) y (BinaryProduct (->) z y) # (^^^) :: forall (z1 :: k) (z2 :: k) (y2 :: k) (y1 :: k). (z1 -> z2) -> (y2 -> y1) -> Exponential (->) y1 z1 -> Exponential (->) y2 z2 # | |
| CartesianClosed Cat # | Exponentials in |
Defined in Data.Category.CartesianClosed Associated Types type Exponential Cat y z :: Kind k # Methods apply :: forall (y :: k) (z :: k). Obj Cat y -> Obj Cat z -> Cat (BinaryProduct Cat (Exponential Cat y z) y) z # tuple :: forall (y :: k) (z :: k). Obj Cat y -> Obj Cat z -> Cat z (Exponential Cat y (BinaryProduct Cat z y)) # (^^^) :: forall (z1 :: k) (z2 :: k) (y2 :: k) (y1 :: k). Cat z1 z2 -> Cat y2 y1 -> Cat (Exponential Cat y1 z1) (Exponential Cat y2 z2) # | |
data ExpFunctor (k :: * -> * -> *) #
Constructors
| ExpFunctor |
Instances
| CartesianClosed k => Functor (ExpFunctor k) # | The exponential as a bifunctor. |
Defined in Data.Category.CartesianClosed Associated Types type Dom (ExpFunctor k) :: Type -> Type -> Type # type Cod (ExpFunctor k) :: Type -> Type -> Type # type (ExpFunctor k) :% a # Methods (%) :: ExpFunctor k -> Dom (ExpFunctor k) a b -> Cod (ExpFunctor k) (ExpFunctor k :% a) (ExpFunctor k :% b) # | |
| type Dom (ExpFunctor k) # | |
Defined in Data.Category.CartesianClosed | |
| type Cod (ExpFunctor k) # | |
Defined in Data.Category.CartesianClosed | |
| type (ExpFunctor k) :% (y, z) # | |
Defined in Data.Category.CartesianClosed | |
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)) #
type PShExponential k y z = (Presheaves k :-*: z) :.: Opposite ((ProductFunctor (Presheaves k) :.: Tuple2 (Presheaves k) (Presheaves k) y) :.: YonedaEmbedding k) #
pattern PshExponential :: Category k => Obj (Presheaves k) y -> Obj (Presheaves k) z -> PShExponential k y z #
curryAdj :: CartesianClosed k => Obj k y -> Adjunction k k (ProductFunctor k :.: Tuple2 k k y) (ExpFunctor k :.: Tuple1 (Op k) k y) #
The product functor is left adjoint the the exponential functor.
curry :: (CartesianClosed k, Kind k ~ *) => Obj k x -> Obj k y -> Obj k z -> k (BinaryProduct k x y) z -> k x (Exponential k y z) #
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, Kind k ~ *) => Obj k x -> Obj k y -> Obj k z -> k x (Exponential k y z) -> k (BinaryProduct k x y) z #
type State k s a = Exponential k s (BinaryProduct k a s) #
From every adjunction we get a monad, in this case the State monad.
stateMonadReturn :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k a (State k s a) #
stateMonadJoin :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k (State k s (State k s a)) (State k s a) #
type Context k s a = BinaryProduct k (Exponential k s a) s #
contextComonadExtract :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k (Context k s a) a #
contextComonadDuplicate :: (CartesianClosed k, Kind k ~ *) => Obj k s -> Obj k a -> k (Context k s a) (Context k s (Context k s a)) #