overloaded-0.3: Overloaded pragmas as a plugin
Safe HaskellSafe-Inferred
LanguageHaskell2010

Overloaded.Categories

Description

Overloaded Categories, desugar Arrow into classes in this module.

Enabled with

{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Categories #-}

Description

Arrows notation - GHC manual chapter - is cool, but it desugars into "wrong" classes. The arr combinator is used for plumbing. We should desugar to proper type-classes:

Examples

Expression like

catAssoc
    :: CartesianCategory cat
    => cat (Product cat (Product cat a b) c) (Product cat a (Product cat b c))
catAssoc = proc ((x, y), z) -> identity -< (x, (y, z))

are desugared to (a mess which is)

fanout (proj1 %% proj1) (fanout (proj2 %% proj1) proj2)

If you are familiar with arrows-operators, this is similar to

(fst . fst) &&& (snd . fst &&& snd)

expression.

The catAssoc could be instantiated to cat = (->), or more interestingly for example instantiate it to STLC morphisms to get an expression like:

Lam (Pair (Fst (Fst (Var Here))) (Pair (Snd (Fst (Var Here))) (Snd (Var Here))))

proc notation is nicer than writing de Bruijn indices.

This is very similar idea to Conal Elliott's Compiling to Categories work. This approach is syntactically more heavy, but works in more correct stage of compiler, before actual desugarer.

As one more example, we implement the automatic differentiation, as in Conal's paper(s). To keep things simple we use

newtype AD a b = AD (a -> (b, a -> b))

representation, i.e. use ordinary maps to represent linear maps. We then define a function

evaluateAD :: Functor f => AD a b -> a -> f a -> (b, f b)
evaluateAD (AD f) x xs = let (y, f') = f x in (y, fmap f' xs)

which would allow to calculuate function value and derivatives in given directions. Then we can define simple quadratic function:

quad :: AD (Double, Double) Double
quad = proc (x, y) -> do
    x2 <- mult -< (x, x)
    y2 <- mult -< (y, y)
    plus -< (x2, y2)

It's not as simple as writing quad x y = x * x + y * y, but not too far.

Then we can play with it. At origo everything is zero:

let sqrthf = 1 / sqrt 2
in evaluateAD quad (0, 0) [(1,0), (0,1), (sqrthf, sqrthf)] = (0.0,[0.0,0.0,0.0])

If we evaluate at some other point, we see things working:

evaluateAD quad (1, 2) [(1,0), (0,1), (sqrthf, sqrthf)] = (5.0,[2.0,4.0,4.242640687119285])

Obviously, if we would use inspectable representation for linear maps, as Conal describe, we'd get more benefits. And then arr wouldn't be definable!

Synopsis

Category

class Category (cat :: k -> k -> Type) #

A class for categories. Instances should satisfy the laws

Right identity
f . id = f
Left identity
id . f = f
Associativity
f . (g . h) = (f . g) . h

Minimal complete definition

id, (.)

Instances

Instances details
Category (Coercion :: k -> k -> Type)

Since: base-4.7.0.0

Instance details

Defined in Control.Category

Methods

id :: forall (a :: k0). Coercion a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). Coercion b c -> Coercion a b -> Coercion a c #

Category ((:~:) :: k -> k -> Type)

Since: base-4.7.0.0

Instance details

Defined in Control.Category

Methods

id :: forall (a :: k0). a :~: a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). (b :~: c) -> (a :~: b) -> a :~: c #

Category ((:~~:) :: k -> k -> Type)

Since: base-4.10.0.0

Instance details

Defined in Control.Category

Methods

id :: forall (a :: k0). a :~~: a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). (b :~~: c) -> (a :~~: b) -> a :~~: c #

Category arr => Category (WrappedArrow arr :: k -> k -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Methods

id :: forall (a :: k0). WrappedArrow arr a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). WrappedArrow arr b c -> WrappedArrow arr a b -> WrappedArrow arr a c #

Category k2 => Category (Dual k2 :: k1 -> k1 -> Type) 
Instance details

Defined in Data.Semigroupoid.Dual

Methods

id :: forall (a :: k). Dual k2 a a #

(.) :: forall (b :: k) (c :: k) (a :: k). Dual k2 b c -> Dual k2 a b -> Dual k2 a c #

Category p => Category (WrappedArrow p :: k -> k -> Type) 
Instance details

Defined in Data.Profunctor.Types

Methods

id :: forall (a :: k0). WrappedArrow p a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). WrappedArrow p b c -> WrappedArrow p a b -> WrappedArrow p a c #

(Category p, Category q) => Category (Product p q :: k -> k -> Type) 
Instance details

Defined in Data.Bifunctor.Product

Methods

id :: forall (a :: k0). Product p q a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). Product p q b c -> Product p q a b -> Product p q a c #

(Applicative f, Category p) => Category (Tannen f p :: k -> k -> Type) 
Instance details

Defined in Data.Bifunctor.Tannen

Methods

id :: forall (a :: k0). Tannen f p a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). Tannen f p b c -> Tannen f p a b -> Tannen f p a c #

Category Op 
Instance details

Defined in Data.Functor.Contravariant

Methods

id :: forall (a :: k). Op a a #

(.) :: forall (b :: k) (c :: k) (a :: k). Op b c -> Op a b -> Op a c #

Monad m => Category (Kleisli m :: Type -> Type -> Type)

Since: base-3.0

Instance details

Defined in Control.Arrow

Methods

id :: forall (a :: k). Kleisli m a a #

(.) :: forall (b :: k) (c :: k) (a :: k). Kleisli m b c -> Kleisli m a b -> Kleisli m a c #

(Applicative f, Monad f) => Category (WhenMissing f :: Type -> Type -> Type)

Since: containers-0.5.9

Instance details

Defined in Data.IntMap.Internal

Methods

id :: forall (a :: k). WhenMissing f a a #

(.) :: forall (b :: k) (c :: k) (a :: k). WhenMissing f b c -> WhenMissing f a b -> WhenMissing f a c #

Category ((->) :: Type -> Type -> Type)

Since: base-3.0

Instance details

Defined in Control.Category

Methods

id :: forall (a :: k). a -> a #

(.) :: forall (b :: k) (c :: k) (a :: k). (b -> c) -> (a -> b) -> a -> c #

(Monad f, Applicative f) => Category (WhenMatched f x :: Type -> Type -> Type)

Since: containers-0.5.9

Instance details

Defined in Data.IntMap.Internal

Methods

id :: forall (a :: k). WhenMatched f x a a #

(.) :: forall (b :: k) (c :: k) (a :: k). WhenMatched f x b c -> WhenMatched f x a b -> WhenMatched f x a c #

(Applicative f, Monad f) => Category (WhenMissing f k :: Type -> Type -> Type)

Since: containers-0.5.9

Instance details

Defined in Data.Map.Internal

Methods

id :: forall (a :: k0). WhenMissing f k a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). WhenMissing f k b c -> WhenMissing f k a b -> WhenMissing f k a c #

Monad f => Category (Star f :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Types

Methods

id :: forall (a :: k). Star f a a #

(.) :: forall (b :: k) (c :: k) (a :: k). Star f b c -> Star f a b -> Star f a c #

(Monad f, Applicative f) => Category (WhenMatched f k x :: Type -> Type -> Type)

Since: containers-0.5.9

Instance details

Defined in Data.Map.Internal

Methods

id :: forall (a :: k0). WhenMatched f k x a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). WhenMatched f k x b c -> WhenMatched f k x a b -> WhenMatched f k x a c #

identity :: Category cat => cat a a Source #

A non-clashing name for id.

(%%) :: Category cat => cat b c -> cat a b -> cat a c infixr 9 Source #

A non-clashing name for (.).

Monoidial

class Category cat => SemigroupalCategory (cat :: k -> k -> Type) where Source #

Associated Types

type Tensor cat :: k -> k -> k Source #

Methods

assoc :: cat (Tensor cat (Tensor cat a b) c) (Tensor cat a (Tensor cat b c)) Source #

unassoc :: cat (Tensor cat a (Tensor cat b c)) (Tensor cat (Tensor cat a b) c) Source #

defaultAssoc :: (CartesianCategory cat, Tensor cat ~ Product cat) => cat (Tensor cat (Tensor cat a b) c) (Tensor cat a (Tensor cat b c)) Source #

defaultUnassoc :: (CartesianCategory cat, Tensor cat ~ Product cat) => cat (Tensor cat a (Tensor cat b c)) (Tensor cat (Tensor cat a b) c) Source #

class SemigroupalCategory cat => MonoidalCategory (cat :: k -> k -> Type) where Source #

Associated Types

type Unit cat :: k Source #

Methods

lunit :: cat (Tensor cat (Unit cat) a) a Source #

runit :: cat (Tensor cat a (Unit cat)) a Source #

unlunit :: cat a (Tensor cat (Unit cat) a) Source #

unrunit :: cat a (Tensor cat a (Unit cat)) Source #

defaultLunit :: (CartesianCategory cat, Tensor cat ~ Product cat) => cat (Tensor cat (Unit cat) a) a Source #

defaultRunit :: (CartesianCategory cat, Tensor cat ~ Product cat) => cat (Tensor cat a (Unit cat)) a Source #

defaultUnrunit :: (CategoryWith1 cat, Tensor cat ~ Product cat, Unit cat ~ Terminal cat) => cat a (Tensor cat a (Unit cat)) Source #

defaultUnlunit :: (CategoryWith1 cat, Tensor cat ~ Product cat, Unit cat ~ Terminal cat) => cat a (Tensor cat (Unit cat) a) Source #

class SemigroupalCategory cat => CommutativeCategory cat where Source #

Methods

swap :: cat (Tensor cat a b) (Tensor cat b a) Source #

defaultSwap :: (CartesianCategory cat, Tensor cat ~ Product cat) => cat (Tensor cat a b) (Tensor cat b a) Source #

Product and Terminal

class Category cat => CartesianCategory (cat :: k -> k -> Type) where Source #

Cartesian category is a monoidal category where monoidal product is the categorical product.

Associated Types

type Product cat :: k -> k -> k Source #

Methods

proj1 :: cat (Product cat a b) a Source #

proj2 :: cat (Product cat a b) b Source #

fanout :: cat a b -> cat a c -> cat a (Product cat b c) Source #

fanout f g is written as \(\langle f, g \rangle\) in category theory literature.

Instances

Instances details
CocartesianCategory cat => CartesianCategory (Dual cat :: k -> k -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Product (Dual cat) :: k -> k -> k Source #

Methods

proj1 :: forall (a :: k0) (b :: k0). Dual cat (Product (Dual cat) a b) a Source #

proj2 :: forall (a :: k0) (b :: k0). Dual cat (Product (Dual cat) a b) b Source #

fanout :: forall (a :: k0) (b :: k0) (c :: k0). Dual cat a b -> Dual cat a c -> Dual cat a (Product (Dual cat) b c) Source #

CartesianCategory Op Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Product Op :: k -> k -> k Source #

Methods

proj1 :: forall (a :: k) (b :: k). Op (Product Op a b) a Source #

proj2 :: forall (a :: k) (b :: k). Op (Product Op a b) b Source #

fanout :: forall (a :: k) (b :: k) (c :: k). Op a b -> Op a c -> Op a (Product Op b c) Source #

Monad m => CartesianCategory (Kleisli m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Product (Kleisli m) :: k -> k -> k Source #

Methods

proj1 :: forall (a :: k) (b :: k). Kleisli m (Product (Kleisli m) a b) a Source #

proj2 :: forall (a :: k) (b :: k). Kleisli m (Product (Kleisli m) a b) b Source #

fanout :: forall (a :: k) (b :: k) (c :: k). Kleisli m a b -> Kleisli m a c -> Kleisli m a (Product (Kleisli m) b c) Source #

CartesianCategory ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Product (->) :: k -> k -> k Source #

Methods

proj1 :: forall (a :: k) (b :: k). Product (->) a b -> a Source #

proj2 :: forall (a :: k) (b :: k). Product (->) a b -> b Source #

fanout :: forall (a :: k) (b :: k) (c :: k). (a -> b) -> (a -> c) -> a -> Product (->) b c Source #

Monad m => CartesianCategory (Star m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Product (Star m) :: k -> k -> k Source #

Methods

proj1 :: forall (a :: k) (b :: k). Star m (Product (Star m) a b) a Source #

proj2 :: forall (a :: k) (b :: k). Star m (Product (Star m) a b) b Source #

fanout :: forall (a :: k) (b :: k) (c :: k). Star m a b -> Star m a c -> Star m a (Product (Star m) b c) Source #

Arrow arr => CartesianCategory (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Product (WrappedArrow arr) :: k -> k -> k Source #

Methods

proj1 :: forall (a :: k) (b :: k). WrappedArrow arr (Product (WrappedArrow arr) a b) a Source #

proj2 :: forall (a :: k) (b :: k). WrappedArrow arr (Product (WrappedArrow arr) a b) b Source #

fanout :: forall (a :: k) (b :: k) (c :: k). WrappedArrow arr a b -> WrappedArrow arr a c -> WrappedArrow arr a (Product (WrappedArrow arr) b c) Source #

class CartesianCategory cat => CategoryWith1 (cat :: k -> k -> Type) where Source #

Category with terminal object.

Associated Types

type Terminal cat :: k Source #

Methods

terminal :: cat a (Terminal cat) Source #

Instances

Instances details
CategoryWith0 cat => CategoryWith1 (Dual cat :: k -> k -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Terminal (Dual cat) :: k Source #

Methods

terminal :: forall (a :: k0). Dual cat a (Terminal (Dual cat)) Source #

CategoryWith1 Op Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Terminal Op :: k Source #

Methods

terminal :: forall (a :: k). Op a (Terminal Op) Source #

Monad m => CategoryWith1 (Kleisli m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Terminal (Kleisli m) :: k Source #

Methods

terminal :: forall (a :: k). Kleisli m a (Terminal (Kleisli m)) Source #

CategoryWith1 ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Terminal (->) :: k Source #

Methods

terminal :: forall (a :: k). a -> Terminal (->) Source #

Monad m => CategoryWith1 (Star m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Terminal (Star m) :: k Source #

Methods

terminal :: forall (a :: k). Star m a (Terminal (Star m)) Source #

Arrow arr => CategoryWith1 (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Terminal (WrappedArrow arr) :: k Source #

Methods

terminal :: forall (a :: k). WrappedArrow arr a (Terminal (WrappedArrow arr)) Source #

Coproduct and initial

class CocartesianCategory cat => CategoryWith0 (cat :: k -> k -> Type) where Source #

Category with initial object.

Associated Types

type Initial cat :: k Source #

Methods

initial :: cat (Initial cat) a Source #

Instances

Instances details
CategoryWith1 cat => CategoryWith0 (Dual cat :: k -> k -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Initial (Dual cat) :: k Source #

Methods

initial :: forall (a :: k0). Dual cat (Initial (Dual cat)) a Source #

CategoryWith0 Op Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Initial Op :: k Source #

Methods

initial :: forall (a :: k). Op (Initial Op) a Source #

Monad m => CategoryWith0 (Kleisli m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Initial (Kleisli m) :: k Source #

Methods

initial :: forall (a :: k). Kleisli m (Initial (Kleisli m)) a Source #

CategoryWith0 ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Initial (->) :: k Source #

Methods

initial :: forall (a :: k). Initial (->) -> a Source #

Monad m => CategoryWith0 (Star m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Initial (Star m) :: k Source #

Methods

initial :: forall (a :: k). Star m (Initial (Star m)) a Source #

ArrowChoice arr => CategoryWith0 (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Initial (WrappedArrow arr) :: k Source #

Methods

initial :: forall (a :: k). WrappedArrow arr (Initial (WrappedArrow arr)) a Source #

class Category cat => CocartesianCategory (cat :: k -> k -> Type) where Source #

Cocartesian category is a monoidal category where monoidal product is the categorical coproduct.

Associated Types

type Coproduct cat :: k -> k -> k Source #

Methods

inl :: cat a (Coproduct cat a b) Source #

inr :: cat b (Coproduct cat a b) Source #

fanin :: cat a c -> cat b c -> cat (Coproduct cat a b) c Source #

fanin f g is written as \([f, g]\) in category theory literature.

Instances

Instances details
CartesianCategory cat => CocartesianCategory (Dual cat :: k -> k -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Coproduct (Dual cat) :: k -> k -> k Source #

Methods

inl :: forall (a :: k0) (b :: k0). Dual cat a (Coproduct (Dual cat) a b) Source #

inr :: forall (b :: k0) (a :: k0). Dual cat b (Coproduct (Dual cat) a b) Source #

fanin :: forall (a :: k0) (c :: k0) (b :: k0). Dual cat a c -> Dual cat b c -> Dual cat (Coproduct (Dual cat) a b) c Source #

CocartesianCategory Op Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Coproduct Op :: k -> k -> k Source #

Methods

inl :: forall (a :: k) (b :: k). Op a (Coproduct Op a b) Source #

inr :: forall (b :: k) (a :: k). Op b (Coproduct Op a b) Source #

fanin :: forall (a :: k) (c :: k) (b :: k). Op a c -> Op b c -> Op (Coproduct Op a b) c Source #

Monad m => CocartesianCategory (Kleisli m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Coproduct (Kleisli m) :: k -> k -> k Source #

Methods

inl :: forall (a :: k) (b :: k). Kleisli m a (Coproduct (Kleisli m) a b) Source #

inr :: forall (b :: k) (a :: k). Kleisli m b (Coproduct (Kleisli m) a b) Source #

fanin :: forall (a :: k) (c :: k) (b :: k). Kleisli m a c -> Kleisli m b c -> Kleisli m (Coproduct (Kleisli m) a b) c Source #

CocartesianCategory ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Coproduct (->) :: k -> k -> k Source #

Methods

inl :: forall (a :: k) (b :: k). a -> Coproduct (->) a b Source #

inr :: forall (b :: k) (a :: k). b -> Coproduct (->) a b Source #

fanin :: forall (a :: k) (c :: k) (b :: k). (a -> c) -> (b -> c) -> Coproduct (->) a b -> c Source #

Monad m => CocartesianCategory (Star m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Coproduct (Star m) :: k -> k -> k Source #

Methods

inl :: forall (a :: k) (b :: k). Star m a (Coproduct (Star m) a b) Source #

inr :: forall (b :: k) (a :: k). Star m b (Coproduct (Star m) a b) Source #

fanin :: forall (a :: k) (c :: k) (b :: k). Star m a c -> Star m b c -> Star m (Coproduct (Star m) a b) c Source #

ArrowChoice arr => CocartesianCategory (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Coproduct (WrappedArrow arr) :: k -> k -> k Source #

Methods

inl :: forall (a :: k) (b :: k). WrappedArrow arr a (Coproduct (WrappedArrow arr) a b) Source #

inr :: forall (b :: k) (a :: k). WrappedArrow arr b (Coproduct (WrappedArrow arr) a b) Source #

fanin :: forall (a :: k) (c :: k) (b :: k). WrappedArrow arr a c -> WrappedArrow arr b c -> WrappedArrow arr (Coproduct (WrappedArrow arr) a b) c Source #

Bicartesian

class (CartesianCategory cat, CocartesianCategory cat) => BicartesianCategory cat where Source #

Bicartesian category is category which is both cartesian and cocartesian.

We also require distributive morpism.

Methods

distr :: cat (Product cat (Coproduct cat a b) c) (Coproduct cat (Product cat a c) (Product cat b c)) Source #

Instances

Instances details
Monad m => BicartesianCategory (Kleisli m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Methods

distr :: forall (a :: k) (b :: k) (c :: k). Kleisli m (Product (Kleisli m) (Coproduct (Kleisli m) a b) c) (Coproduct (Kleisli m) (Product (Kleisli m) a c) (Product (Kleisli m) b c)) Source #

BicartesianCategory ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Methods

distr :: forall (a :: k) (b :: k) (c :: k). Product (->) (Coproduct (->) a b) c -> Coproduct (->) (Product (->) a c) (Product (->) b c) Source #

Monad m => BicartesianCategory (Star m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Methods

distr :: forall (a :: k) (b :: k) (c :: k). Star m (Product (Star m) (Coproduct (Star m) a b) c) (Coproduct (Star m) (Product (Star m) a c) (Product (Star m) b c)) Source #

ArrowChoice arr => BicartesianCategory (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Methods

distr :: forall (a :: k) (b :: k) (c :: k). WrappedArrow arr (Product (WrappedArrow arr) (Coproduct (WrappedArrow arr) a b) c) (Coproduct (WrappedArrow arr) (Product (WrappedArrow arr) a c) (Product (WrappedArrow arr) b c)) Source #

Closed cartesian category

class CartesianCategory cat => CCC (cat :: k -> k -> Type) where Source #

Closed cartesian category.

Associated Types

type Exponential cat :: k -> k -> k Source #

Exponential cat a b represents \(B^A\). This is due how (->) works.

Methods

eval :: cat (Product cat (Exponential cat a b) a) b Source #

transpose :: cat (Product cat a b) c -> cat a (Exponential cat b c) Source #

Instances

Instances details
Monad m => CCC (Kleisli m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Exponential (Kleisli m) :: k -> k -> k Source #

Methods

eval :: forall (a :: k) (b :: k). Kleisli m (Product (Kleisli m) (Exponential (Kleisli m) a b) a) b Source #

transpose :: forall (a :: k) (b :: k) (c :: k). Kleisli m (Product (Kleisli m) a b) c -> Kleisli m a (Exponential (Kleisli m) b c) Source #

CCC ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Exponential (->) :: k -> k -> k Source #

Methods

eval :: forall (a :: k) (b :: k). Product (->) (Exponential (->) a b) a -> b Source #

transpose :: forall (a :: k) (b :: k) (c :: k). (Product (->) a b -> c) -> a -> Exponential (->) b c Source #

Monad m => CCC (Star m :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Exponential (Star m) :: k -> k -> k Source #

Methods

eval :: forall (a :: k) (b :: k). Star m (Product (Star m) (Exponential (Star m) a b) a) b Source #

transpose :: forall (a :: k) (b :: k) (c :: k). Star m (Product (Star m) a b) c -> Star m a (Exponential (Star m) b c) Source #

ArrowApply arr => CCC (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Exponential (WrappedArrow arr) :: k -> k -> k Source #

Methods

eval :: forall (a :: k) (b :: k). WrappedArrow arr (Product (WrappedArrow arr) (Exponential (WrappedArrow arr) a b) a) b Source #

transpose :: forall (a :: k) (b :: k) (c :: k). WrappedArrow arr (Product (WrappedArrow arr) a b) c -> WrappedArrow arr a (Exponential (WrappedArrow arr) b c) Source #

Generalized element

class Category cat => GeneralizedElement (cat :: k -> k -> Type) where Source #

Associated Types

type Object cat (a :: k) :: Type Source #

Methods

konst :: Object cat a -> cat x a Source #

Instances

Instances details
GeneralizedElement ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Object (->) a Source #

Methods

konst :: forall (a :: k) (x :: k). Object (->) a -> x -> a Source #

Arrow arr => GeneralizedElement (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Object (WrappedArrow arr) a Source #

Methods

konst :: forall (a :: k) (x :: k). Object (WrappedArrow arr) a -> WrappedArrow arr x a Source #

WrappedArrow

newtype WrappedArrow arr a b Source #

Constructors

WrapArrow 

Fields

Instances

Instances details
Category arr => Category (WrappedArrow arr :: k -> k -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Methods

id :: forall (a :: k0). WrappedArrow arr a a #

(.) :: forall (b :: k0) (c :: k0) (a :: k0). WrappedArrow arr b c -> WrappedArrow arr a b -> WrappedArrow arr a c #

Arrow arr => GeneralizedElement (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Object (WrappedArrow arr) a Source #

Methods

konst :: forall (a :: k) (x :: k). Object (WrappedArrow arr) a -> WrappedArrow arr x a Source #

ArrowApply arr => CCC (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Exponential (WrappedArrow arr) :: k -> k -> k Source #

Methods

eval :: forall (a :: k) (b :: k). WrappedArrow arr (Product (WrappedArrow arr) (Exponential (WrappedArrow arr) a b) a) b Source #

transpose :: forall (a :: k) (b :: k) (c :: k). WrappedArrow arr (Product (WrappedArrow arr) a b) c -> WrappedArrow arr a (Exponential (WrappedArrow arr) b c) Source #

ArrowChoice arr => BicartesianCategory (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Methods

distr :: forall (a :: k) (b :: k) (c :: k). WrappedArrow arr (Product (WrappedArrow arr) (Coproduct (WrappedArrow arr) a b) c) (Coproduct (WrappedArrow arr) (Product (WrappedArrow arr) a c) (Product (WrappedArrow arr) b c)) Source #

ArrowChoice arr => CocartesianCategory (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Coproduct (WrappedArrow arr) :: k -> k -> k Source #

Methods

inl :: forall (a :: k) (b :: k). WrappedArrow arr a (Coproduct (WrappedArrow arr) a b) Source #

inr :: forall (b :: k) (a :: k). WrappedArrow arr b (Coproduct (WrappedArrow arr) a b) Source #

fanin :: forall (a :: k) (c :: k) (b :: k). WrappedArrow arr a c -> WrappedArrow arr b c -> WrappedArrow arr (Coproduct (WrappedArrow arr) a b) c Source #

ArrowChoice arr => CategoryWith0 (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Initial (WrappedArrow arr) :: k Source #

Methods

initial :: forall (a :: k). WrappedArrow arr (Initial (WrappedArrow arr)) a Source #

Arrow arr => CartesianCategory (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Product (WrappedArrow arr) :: k -> k -> k Source #

Methods

proj1 :: forall (a :: k) (b :: k). WrappedArrow arr (Product (WrappedArrow arr) a b) a Source #

proj2 :: forall (a :: k) (b :: k). WrappedArrow arr (Product (WrappedArrow arr) a b) b Source #

fanout :: forall (a :: k) (b :: k) (c :: k). WrappedArrow arr a b -> WrappedArrow arr a c -> WrappedArrow arr a (Product (WrappedArrow arr) b c) Source #

Arrow arr => CategoryWith1 (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

Associated Types

type Terminal (WrappedArrow arr) :: k Source #

Methods

terminal :: forall (a :: k). WrappedArrow arr a (Terminal (WrappedArrow arr)) Source #

type Exponential (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

type Exponential (WrappedArrow arr :: Type -> Type -> Type) = arr
type Coproduct (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

type Coproduct (WrappedArrow arr :: Type -> Type -> Type) = Either
type Initial (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

type Initial (WrappedArrow arr :: Type -> Type -> Type) = Void
type Product (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

type Product (WrappedArrow arr :: Type -> Type -> Type) = (,)
type Terminal (WrappedArrow arr :: Type -> Type -> Type) Source # 
Instance details

Defined in Overloaded.Categories

type Terminal (WrappedArrow arr :: Type -> Type -> Type) = ()
type Object (WrappedArrow arr :: Type -> Type -> Type) (a :: Type) Source # 
Instance details

Defined in Overloaded.Categories

type Object (WrappedArrow arr :: Type -> Type -> Type) (a :: Type) = a