Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | sjoerd@w3future.com |
Safe Haskell | Safe-Inferred |
- type family Exponential k y z :: *
- class (HasTerminalObject k, HasBinaryProducts k) => CartesianClosed k where
- 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
- data Apply y z = Apply
- data ToTuple1 y z = ToTuple1
- data ToTuple2 y z = ToTuple2
- 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 => Obj k x -> Obj k y -> Obj k z -> k (BinaryProduct k x y) z -> k x (Exponential k y z)
- uncurry :: CartesianClosed 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 => Obj k s -> Obj k a -> k a (State k s a)
- stateMonadJoin :: CartesianClosed 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 => Obj k s -> Obj k a -> k (Context k s a) a
- contextComonadDuplicate :: CartesianClosed k => Obj k s -> Obj k a -> k (Context k s a) (Context k s (Context k s a))
Documentation
type family Exponential k y z :: *Source
class (HasTerminalObject k, HasBinaryProducts k) => CartesianClosed k whereSource
A category is cartesian closed if it has all products and exponentials for all objects.
apply :: Obj k y -> Obj k z -> k (BinaryProduct k (Exponential k y z) y) zSource
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
CartesianClosed (->) | Exponentials in |
CartesianClosed Cat | Exponentials in |
CartesianClosed Boolean | Implication makes the Boolean category cartesian closed. |
(HasTerminalObject (Presheaves k), HasBinaryProducts (Presheaves k), Category k) => CartesianClosed (Presheaves k) | The category of presheaves on a category |
data ExpFunctor k Source
(Category (Dom (ExpFunctor k)), Category (Cod (ExpFunctor k)), CartesianClosed k) => Functor (ExpFunctor k) | The exponential as a bifunctor. |
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) zSource
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) sSource
contextComonadExtract :: CartesianClosed k => Obj k s -> Obj k a -> k (Context k s a) aSource
contextComonadDuplicate :: CartesianClosed k => Obj k s -> Obj k a -> k (Context k s a) (Context k s (Context k s a))Source