-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Categories
--   
--   Categories
@package categories
@version 1.0.7


-- | A more categorical definition of <a>Functor</a>
module Control.Categorical.Functor
class (Category r, Category t) => Functor (f :: Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) | f r -> t, f t -> r
fmap :: Functor f r t => r a b -> t (f a) (f b)
class Functor f a a => Endofunctor (f :: Type -> Type) (a :: Type -> Type -> Type)
newtype LiftedFunctor (f :: Type -> Type) a
LiftedFunctor :: f a -> LiftedFunctor (f :: Type -> Type) a
newtype LoweredFunctor (f :: Type -> Type) a
LoweredFunctor :: f a -> LoweredFunctor (f :: Type -> Type) a
instance (GHC.Internal.Data.Typeable.Internal.Typeable f, GHC.Internal.Data.Data.Data (f a), GHC.Internal.Data.Data.Data a) => GHC.Internal.Data.Data.Data (Control.Categorical.Functor.LiftedFunctor f a)
instance (GHC.Internal.Data.Typeable.Internal.Typeable f, GHC.Internal.Data.Data.Data (f a), GHC.Internal.Data.Data.Data a) => GHC.Internal.Data.Data.Data (Control.Categorical.Functor.LoweredFunctor f a)
instance Control.Categorical.Functor.Functor f a a => Control.Categorical.Functor.Endofunctor f a
instance Control.Categorical.Functor.Functor f (->) (->) => GHC.Internal.Base.Functor (Control.Categorical.Functor.LoweredFunctor f)
instance Control.Categorical.Functor.Functor (GHC.Internal.Data.Either.Either a) (->) (->)
instance Control.Categorical.Functor.Functor GHC.Types.IO (->) (->)
instance GHC.Internal.Base.Functor f => Control.Categorical.Functor.Functor (Control.Categorical.Functor.LiftedFunctor f) (->) (->)
instance Control.Categorical.Functor.Functor [] (->) (->)
instance Control.Categorical.Functor.Functor GHC.Internal.Maybe.Maybe (->) (->)
instance Control.Categorical.Functor.Functor ((,) a) (->) (->)
instance GHC.Internal.Read.Read (f a) => GHC.Internal.Read.Read (Control.Categorical.Functor.LiftedFunctor f a)
instance GHC.Internal.Read.Read (f a) => GHC.Internal.Read.Read (Control.Categorical.Functor.LoweredFunctor f a)
instance GHC.Internal.Show.Show (f a) => GHC.Internal.Show.Show (Control.Categorical.Functor.LiftedFunctor f a)
instance GHC.Internal.Show.Show (f a) => GHC.Internal.Show.Show (Control.Categorical.Functor.LoweredFunctor f a)


-- | This module declares the <a>HasTerminalObject</a> and
--   <a>HasInitialObject</a> classes.
--   
--   These are both special cases of the idea of a (co)limit.
module Control.Categorical.Object

-- | The <tt>Category (~&gt;)</tt> has a terminal object <tt>Terminal
--   (~&gt;)</tt> such that for all objects <tt>a</tt> in <tt>(~&gt;)</tt>,
--   there exists a unique morphism from <tt>a</tt> to <tt>Terminal
--   (~&gt;)</tt>.
class Category k => HasTerminalObject (k :: Type -> Type -> Type) where {
    type Terminal (k :: Type -> Type -> Type);
}
terminate :: HasTerminalObject k => k a (Terminal k)

-- | The <tt>Category (~&gt;)</tt> has an initial (coterminal) object
--   <tt>Initial (~&gt;)</tt> such that for all objects <tt>a</tt> in
--   <tt>(~&gt;)</tt>, there exists a unique morphism from <tt>Initial
--   (~&gt;) </tt> to <tt>a</tt>.
class Category k => HasInitialObject (k :: Type -> Type -> Type) where {
    type Initial (k :: Type -> Type -> Type);
}
initiate :: HasInitialObject k => k (Initial k) a


module Control.Category.Discrete

-- | Category of discrete objects. The only arrows are identity arrows.
data Discrete a b
[Refl] :: forall a. Discrete a a

-- | Discrete a b acts as a proof that a = b, lift that proof into
--   something of kind * -&gt; *
liftDiscrete :: Discrete a b -> Discrete (f a) (f b)

-- | Lower the proof that a ~ b to an arbitrary category.
cast :: Category k => Discrete a b -> k a b
inverse :: Discrete a b -> Discrete b a
instance GHC.Internal.Control.Category.Category Control.Category.Discrete.Discrete


module Control.Category.Dual
data Dual (k :: Type -> Type -> Type) a b
Dual :: k b a -> Dual (k :: Type -> Type -> Type) a b
[runDual] :: Dual (k :: Type -> Type -> Type) a b -> k b a
instance GHC.Internal.Control.Category.Category k => GHC.Internal.Control.Category.Category (Control.Category.Dual.Dual k)
instance (GHC.Internal.Data.Typeable.Internal.Typeable k, GHC.Internal.Data.Data.Data a, GHC.Internal.Data.Data.Data b, GHC.Internal.Data.Data.Data (k b a)) => GHC.Internal.Data.Data.Data (Control.Category.Dual.Dual k a b)


-- | A more categorical definition of <a>Bifunctor</a>
module Control.Categorical.Bifunctor
class (Category r, Category t) => PFunctor (p :: Type -> Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) | p r -> t, p t -> r
first :: PFunctor p r t => r a b -> t (p a c) (p b c)
class (Category s, Category t) => QFunctor (q :: Type -> Type -> Type) (s :: Type -> Type -> Type) (t :: Type -> Type -> Type) | q s -> t, q t -> s
second :: QFunctor q s t => s a b -> t (q c a) (q c b)

-- | Minimal definition: <tt>bimap</tt>
class (PFunctor p r t, QFunctor p s t) => Bifunctor (p :: Type -> Type -> Type) (r :: Type -> Type -> Type) (s :: Type -> Type -> Type) (t :: Type -> Type -> Type) | p r -> s t, p s -> r t, p t -> r s
bimap :: Bifunctor p r s t => r a b -> s c d -> t (p a c) (p b d)
dimap :: Bifunctor f (Dual s) t u => s b a -> t c d -> u (f a c) (f b d)
difirst :: PFunctor f (Dual s) t => s b a -> t (f a c) (f b c)
instance Control.Categorical.Bifunctor.Bifunctor GHC.Internal.Data.Either.Either (->) (->) (->)
instance Control.Categorical.Bifunctor.Bifunctor (,) (->) (->) (->)
instance Control.Categorical.Bifunctor.PFunctor GHC.Internal.Data.Either.Either (->) (->)
instance Control.Categorical.Bifunctor.PFunctor (,) (->) (->)
instance Control.Categorical.Bifunctor.QFunctor GHC.Internal.Data.Either.Either (->) (->)
instance Control.Categorical.Bifunctor.QFunctor (->) (->) (->)
instance Control.Categorical.Bifunctor.QFunctor (,) (->) (->)


-- | where the pentagonal condition does not hold, but for which there is
--   an identity.
module Control.Category.Associative

-- | A category with an associative bifunctor satisfying Mac Lane's
--   pentagonal coherence identity law:
--   
--   <pre>
--   bimap id associate . associate . bimap associate id = associate . associate
--   bimap disassociate id . disassociate . bimap id disassociate = disassociate . disassociate
--   </pre>
class Bifunctor p k k k => Associative (k :: Type -> Type -> Type) (p :: Type -> Type -> Type)
associate :: Associative k p => k (p (p a b) c) (p a (p b c))
disassociate :: Associative k p => k (p a (p b c)) (p (p a b) c)
instance Control.Category.Associative.Associative (->) GHC.Internal.Data.Either.Either
instance Control.Category.Associative.Associative (->) (,)


module Control.Category.Braided

-- | A braided (co)(monoidal or associative) category can commute the
--   arguments of its bi-endofunctor. Obeys the laws:
--   
--   <pre>
--   associate . braid . associate = second braid . associate . first braid
--   disassociate . braid . disassociate = first braid . disassociate . second braid
--   </pre>
--   
--   If the category is Monoidal the following laws should be satisfied
--   
--   <pre>
--   idr . braid = idl
--   idl . braid = idr
--   </pre>
--   
--   If the category is Comonoidal the following laws should be satisfied
--   
--   <pre>
--   braid . coidr = coidl
--   braid . coidl = coidr
--   </pre>
class Associative k p => Braided (k :: Type -> Type -> Type) (p :: Type -> Type -> Type)
braid :: Braided k p => k (p a b) (p b a)

-- | If we have a symmetric (co)<tt>Monoidal</tt> category, you get the
--   additional law:
--   
--   <pre>
--   swap . swap = id
--   </pre>
class Braided k p => Symmetric (k :: Type -> Type -> Type) (p :: Type -> Type -> Type)
swap :: Symmetric k p => k (p a b) (p b a)
instance Control.Category.Braided.Braided (->) GHC.Internal.Data.Either.Either
instance Control.Category.Braided.Braided (->) (,)
instance Control.Category.Braided.Symmetric (->) GHC.Internal.Data.Either.Either
instance Control.Category.Braided.Symmetric (->) (,)


-- | A <a>Monoidal</a> category is a category with an associated
--   biendofunctor that has an identity, which satisfies Mac Lane''s
--   pentagonal and triangular coherence conditions Technically we usually
--   say that category is <a>Monoidal</a>, but since most interesting
--   categories in our world have multiple candidate bifunctors that you
--   can use to enrich their structure, we choose here to think of the
--   bifunctor as being monoidal. This lets us reuse the same
--   <tt>Bifunctor</tt> over different categories without painful newtype
--   wrapping.
module Control.Category.Monoidal

-- | Denotes that we have some reasonable notion of <tt>Identity</tt> for a
--   particular <tt>Bifunctor</tt> in this <tt>Category</tt>. This notion
--   is currently used by both <a>Monoidal</a> and <tt>Comonoidal</tt>
--   
--   A monoidal category. <a>idl</a> and <a>idr</a> are traditionally
--   denoted lambda and rho the triangle identities hold:
--   
--   <pre>
--   first idr = second idl . associate
--   second idl = first idr . associate
--   first idr = disassociate . second idl
--   second idl = disassociate . first idr
--   idr . coidr = id
--   idl . coidl = id
--   coidl . idl = id
--   coidr . idr = id
--   </pre>
class Associative k p => Monoidal (k :: Type -> Type -> Type) (p :: Type -> Type -> Type) where {
    type Id (k :: Type -> Type -> Type) (p :: Type -> Type -> Type);
}
idl :: Monoidal k p => k (p (Id k p) a) a
idr :: Monoidal k p => k (p a (Id k p)) a
coidl :: Monoidal k p => k a (p (Id k p) a)
coidr :: Monoidal k p => k a (p a (Id k p))
instance Control.Category.Monoidal.Monoidal (->) GHC.Internal.Data.Either.Either
instance Control.Category.Monoidal.Monoidal (->) (,)


module Control.Category.Cartesian

-- | Minimum definition:
--   
--   <pre>
--   fst, snd, diag
--   fst, snd, (&amp;&amp;&amp;)
--   </pre>
class (Symmetric k Product k, Monoidal k Product k) => Cartesian (k :: Type -> Type -> Type) where {
    type Product (k :: Type -> Type -> Type) :: Type -> Type -> Type;
}
fst :: Cartesian k => k (Product k a b) a
snd :: Cartesian k => k (Product k a b) b
diag :: Cartesian k => k a (Product k a a)
(&&&) :: Cartesian k => k a b -> k a c -> k a (Product k b c)
infixr 3 &&&

-- | free construction of <a>Bifunctor</a> for the product <a>Bifunctor</a>
--   <tt>Product k</tt> if <tt>(&amp;&amp;&amp;)</tt> is known
bimapProduct :: Cartesian k => k a c -> k b d -> k (Product k a b) (Product k c d)

-- | free construction of <a>Braided</a> for the product <a>Bifunctor</a>
--   <tt>Product k</tt>
braidProduct :: Cartesian k => k (Product k a b) (Product k b a)

-- | free construction of <tt>Associative</tt> for the product
--   <a>Bifunctor</a> <tt>Product k</tt>
associateProduct :: Cartesian k => k (Product k (Product k a b) c) (Product k a (Product k b c))

-- | free construction of <tt>Disassociative</tt> for the product
--   <a>Bifunctor</a> <tt>Product k</tt>
disassociateProduct :: Cartesian k => k (Product k a (Product k b c)) (Product k (Product k a b) c)
class (Monoidal k Sum k, Symmetric k Sum k) => CoCartesian (k :: Type -> Type -> Type) where {
    type Sum (k :: Type -> Type -> Type) :: Type -> Type -> Type;
}
inl :: CoCartesian k => k a (Sum k a b)
inr :: CoCartesian k => k b (Sum k a b)
codiag :: CoCartesian k => k (Sum k a a) a
(|||) :: CoCartesian k => k a c -> k b c -> k (Sum k a b) c
infixr 2 |||

-- | free construction of <a>Bifunctor</a> for the coproduct
--   <a>Bifunctor</a> <tt>Sum k</tt> if <tt>(|||)</tt> is known
bimapSum :: CoCartesian k => k a c -> k b d -> k (Sum k a b) (Sum k c d)

-- | free construction of <a>Braided</a> for the coproduct <a>Bifunctor</a>
--   <tt>Sum k</tt>
braidSum :: CoCartesian k => k (Sum k a b) (Sum k b a)

-- | free construction of <tt>Associative</tt> for the coproduct
--   <a>Bifunctor</a> <tt>Sum k</tt>
associateSum :: CoCartesian k => k (Sum k (Sum k a b) c) (Sum k a (Sum k b c))

-- | free construction of <tt>Disassociative</tt> for the coproduct
--   <a>Bifunctor</a> <tt>Sum k</tt>
disassociateSum :: CoCartesian k => k (Sum k a (Sum k b c)) (Sum k (Sum k a b) c)
instance Control.Category.Cartesian.Cartesian (->)
instance Control.Category.Cartesian.CoCartesian (->)


module Control.Category.Distributive

-- | The canonical factoring morphism.
factor :: (Cartesian k, CoCartesian k) => k (Sum k (Product k a b) (Product k a c)) (Product k a (Sum k b c))

-- | A category in which <a>factor</a> is an isomorphism
class (Cartesian k, CoCartesian k) => Distributive (k :: Type -> Type -> Type)
distribute :: Distributive k => k (Product k a (Sum k b c)) (Sum k (Product k a b) (Product k a c))
instance Control.Category.Distributive.Distributive (->)


module Control.Category.Cartesian.Closed

-- | A <a>CCC</a> has full-fledged monoidal finite products and
--   exponentials
class Cartesian k => CCC (k :: Type -> Type -> Type) where {
    type Exp (k :: Type -> Type -> Type) :: Type -> Type -> Type;
}
apply :: CCC k => k (Product k (Exp k a b) a) b
curry :: CCC k => k (Product k a b) c -> k a (Exp k b c)
uncurry :: CCC k => k a (Exp k b c) -> k (Product k a b) c
unitCCC :: CCC k => k a (Exp k b (Product k b a))
counitCCC :: CCC k => k (Product k b (Exp k b a)) a

-- | A Co-CCC has full-fledged comonoidal finite coproducts and
--   coexponentials
class CoCartesian k => CoCCC (k :: Type -> Type -> Type) where {
    type Coexp (k :: Type -> Type -> Type) :: Type -> Type -> Type;
}
coapply :: CoCCC k => k b (Sum k (Coexp k a b) a)
cocurry :: CoCCC k => k c (Sum k a b) -> k (Coexp k b c) a
uncocurry :: CoCCC k => k (Coexp k b c) a -> k c (Sum k a b)
unitCoCCC :: CoCCC k => k a (Sum k b (Coexp k b a))
counitCoCCC :: CoCCC k => k (Coexp k b (Sum k b a)) a
instance Control.Category.Cartesian.Closed.CCC (->)
