Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
A quiver is a directed graph where loops and multiple arrows between vertices are allowed, a multidigraph. A Haskell quiver is a higher kinded type,
p :: k -> k -> Type
- where vertices are types
x :: k
, - and arrows from
x
toy
are termsp :: p x y
.
Many Haskell typeclasses are constraints on quivers, such as
Category
, Bifunctor
,
Profunctor
, and Arrow
.
Synopsis
- newtype IQ c x y = IQ {
- getIQ :: c x y
- newtype OpQ c x y = OpQ {
- getOpQ :: c y x
- data IsoQ c x y = IsoQ {}
- newtype ApQ m c x y = ApQ {
- getApQ :: m (c x y)
- newtype KQ r x y = KQ {
- getKQ :: r
- data ProductQ p q x y = ProductQ {}
- qswap :: ProductQ p q x y -> ProductQ q p x y
- newtype HomQ p q x y = HomQ {
- getHomQ :: p x y -> q x y
- data ReflQ r x y where
- data ComposeQ p q x z = ComposeQ (p y z) (q x y)
- newtype LeftQ p q x y = LeftQ {
- getLeftQ :: forall w. p w x -> q w y
- newtype RightQ p q x y = RightQ {
- getRightQ :: forall z. p y z -> q x z
Documentation
The identity functor on quivers.
Instances
QFunctor (IQ :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
QMonad (IQ :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
QPointed (IQ :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Functor | |
QTraversable (IQ :: (k -> k -> Type) -> k -> k -> Type) Source # | |
Defined in Data.Quiver.Functor | |
QFoldable (IQ :: (k -> k -> Type) -> k -> k -> Type) Source # | |
Defined in Data.Quiver.Functor qfoldMap :: Category q => (forall (x :: k0) (y :: k0). p x y -> q x y) -> IQ p x y -> q x y Source # qfold :: Category q => IQ q x y -> q x y Source # qfoldr :: (forall (x :: k0) (y :: k0) (z :: k1). p x y -> q y z -> q x z) -> q y z -> IQ p x y -> q x z Source # qfoldl :: (forall (x :: k0) (y :: k1) (z :: k1). q x y -> p y z -> q x z) -> q x y -> IQ p y z -> q x z Source # qtoMonoid :: Monoid m => (forall (x :: k0) (y :: k0). p x y -> m) -> IQ p x y -> m Source # qtoList :: (forall (x :: k0) (y :: k0). p x y -> a) -> IQ p x y -> [a] Source # qtraverse_ :: (Applicative m, Category q) => (forall (x :: k0) (y :: k0). p x y -> m (q x y)) -> IQ p x y -> m (q x y) Source # | |
Category c => Category (IQ c :: k -> k -> Type) Source # | |
Eq (c x y) => Eq (IQ c x y) Source # | |
Ord (c x y) => Ord (IQ c x y) Source # | |
Defined in Data.Quiver | |
Show (c x y) => Show (IQ c x y) Source # | |
(Category c, x ~ y) => Semigroup (IQ c x y) Source # | |
(Category c, x ~ y) => Monoid (IQ c x y) Source # | |
Reverse all the arrows in a quiver.
Instances
QFunctor (OpQ :: (k2 -> k1 -> Type) -> k1 -> k2 -> Type) Source # | |
Category c => Category (OpQ c :: k -> k -> Type) Source # | |
Eq (c y x) => Eq (OpQ c x y) Source # | |
Ord (c y x) => Ord (OpQ c x y) Source # | |
Defined in Data.Quiver | |
Show (c y x) => Show (OpQ c x y) Source # | |
(Category c, x ~ y) => Semigroup (OpQ c x y) Source # | |
(Category c, x ~ y) => Monoid (OpQ c x y) Source # | |
Arrows of IsoQ
are bidirectional edges.
Instances
QFunctor (IsoQ :: (k -> k -> Type) -> k -> k -> Type) Source # | |
Category c => Category (IsoQ c :: k -> k -> Type) Source # | |
(Eq (c x y), Eq (c y x)) => Eq (IsoQ c x y) Source # | |
(Ord (c x y), Ord (c y x)) => Ord (IsoQ c x y) Source # | |
(Show (c x y), Show (c y x)) => Show (IsoQ c x y) Source # | |
(Category c, x ~ y) => Semigroup (IsoQ c x y) Source # | |
(Category c, x ~ y) => Monoid (IsoQ c x y) Source # | |
Apply a constructor to the arrows of a quiver.
Instances
Functor t => QFunctor (ApQ t :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Monad t => QMonad (ApQ t :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Applicative t => QPointed (ApQ t :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Functor | |
(Applicative m, Category c) => Category (ApQ m c :: k -> k -> Type) Source # | |
Eq (m (c x y)) => Eq (ApQ m c x y) Source # | |
Ord (m (c x y)) => Ord (ApQ m c x y) Source # | |
Show (m (c x y)) => Show (ApQ m c x y) Source # | |
(Applicative m, Category c, x ~ y) => Semigroup (ApQ m c x y) Source # | |
(Applicative m, Category c, x ~ y) => Monoid (ApQ m c x y) Source # | |
The constant quiver.
KQ ()
is an indiscrete category.
Instances
QMonoidal (ProductQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) (KQ () :: k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qintro1 :: p x y -> ProductQ (KQ ()) p x y Source # qintro2 :: p x y -> ProductQ p (KQ ()) x y Source # qelim1 :: ProductQ (KQ ()) p x y -> p x y Source # qelim2 :: ProductQ p (KQ ()) x y -> p x y Source # qassoc :: ProductQ (ProductQ p q) r x y -> ProductQ p (ProductQ q r) x y Source # qdisassoc :: ProductQ p (ProductQ q r) x y -> ProductQ (ProductQ p q) r x y Source # | |
Monoid m => Category (KQ m :: k -> k -> Type) Source # | |
Eq r => Eq (KQ r x y) Source # | |
Ord r => Ord (KQ r x y) Source # | |
Defined in Data.Quiver | |
Show r => Show (KQ r x y) Source # | |
(Semigroup m, x ~ y) => Semigroup (KQ m x y) Source # | |
(Monoid m, x ~ y) => Monoid (KQ m x y) Source # | |
data ProductQ p q x y Source #
Cartesian monoidal product of quivers.
Instances
QBifunctor (ProductQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
QClosed (ProductQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) (HomQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) (HomQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qlev :: ProductQ (HomQ p q) p x y -> q x y Source # qrev :: ProductQ p (HomQ p q) x y -> q x y Source # qcurry :: (forall (x :: k) (y :: k). ProductQ p q x y -> r x y) -> p x y -> HomQ q r x y Source # quncurry :: (forall (x :: k) (y :: k). p x y -> HomQ q r x y) -> ProductQ p q x y -> r x y Source # qflurry :: (forall (x :: k) (y :: k). ProductQ p q x y -> r x y) -> q x y -> HomQ p r x y Source # qunflurry :: (forall (x :: k) (y :: k). q x y -> HomQ p r x y) -> ProductQ p q x y -> r x y Source # | |
QFunctor (ProductQ p :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
QMonoidal (ProductQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) (KQ () :: k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qintro1 :: p x y -> ProductQ (KQ ()) p x y Source # qintro2 :: p x y -> ProductQ p (KQ ()) x y Source # qelim1 :: ProductQ (KQ ()) p x y -> p x y Source # qelim2 :: ProductQ p (KQ ()) x y -> p x y Source # qassoc :: ProductQ (ProductQ p q) r x y -> ProductQ p (ProductQ q r) x y Source # qdisassoc :: ProductQ p (ProductQ q r) x y -> ProductQ (ProductQ p q) r x y Source # | |
QTraversable (ProductQ p :: (k -> k -> Type) -> k -> k -> Type) Source # | |
Defined in Data.Quiver.Functor | |
QFoldable (ProductQ p :: (k -> k -> Type) -> k -> k -> Type) Source # | |
Defined in Data.Quiver.Functor qfoldMap :: Category q => (forall (x :: k0) (y :: k0). p0 x y -> q x y) -> ProductQ p p0 x y -> q x y Source # qfold :: Category q => ProductQ p q x y -> q x y Source # qfoldr :: (forall (x :: k0) (y :: k0) (z :: k1). p0 x y -> q y z -> q x z) -> q y z -> ProductQ p p0 x y -> q x z Source # qfoldl :: (forall (x :: k0) (y :: k1) (z :: k1). q x y -> p0 y z -> q x z) -> q x y -> ProductQ p p0 y z -> q x z Source # qtoMonoid :: Monoid m => (forall (x :: k0) (y :: k0). p0 x y -> m) -> ProductQ p p0 x y -> m Source # qtoList :: (forall (x :: k0) (y :: k0). p0 x y -> a) -> ProductQ p p0 x y -> [a] Source # qtraverse_ :: (Applicative m, Category q) => (forall (x :: k0) (y :: k0). p0 x y -> m (q x y)) -> ProductQ p p0 x y -> m (q x y) Source # | |
(Category p, Category q) => Category (ProductQ p q :: k -> k -> Type) Source # | |
(Eq (p x y), Eq (q x y)) => Eq (ProductQ p q x y) Source # | |
(Ord (p x y), Ord (q x y)) => Ord (ProductQ p q x y) Source # | |
Defined in Data.Quiver compare :: ProductQ p q x y -> ProductQ p q x y -> Ordering # (<) :: ProductQ p q x y -> ProductQ p q x y -> Bool # (<=) :: ProductQ p q x y -> ProductQ p q x y -> Bool # (>) :: ProductQ p q x y -> ProductQ p q x y -> Bool # (>=) :: ProductQ p q x y -> ProductQ p q x y -> Bool # max :: ProductQ p q x y -> ProductQ p q x y -> ProductQ p q x y # min :: ProductQ p q x y -> ProductQ p q x y -> ProductQ p q x y # | |
(Show (p x y), Show (q x y)) => Show (ProductQ p q x y) Source # | |
(Category p, Category q, x ~ y) => Semigroup (ProductQ p q x y) Source # | |
(Category p, Category q, x ~ y) => Monoid (ProductQ p q x y) Source # | |
The quiver of quiver morphisms, HomQ
is the internal hom
of the category of quivers.
Instances
QProfunctor (HomQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
QClosed (ProductQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) (HomQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) (HomQ :: (k1 -> k2 -> Type) -> (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qlev :: ProductQ (HomQ p q) p x y -> q x y Source # qrev :: ProductQ p (HomQ p q) x y -> q x y Source # qcurry :: (forall (x :: k) (y :: k). ProductQ p q x y -> r x y) -> p x y -> HomQ q r x y Source # quncurry :: (forall (x :: k) (y :: k). p x y -> HomQ q r x y) -> ProductQ p q x y -> r x y Source # qflurry :: (forall (x :: k) (y :: k). ProductQ p q x y -> r x y) -> q x y -> HomQ p r x y Source # qunflurry :: (forall (x :: k) (y :: k). q x y -> HomQ p r x y) -> ProductQ p q x y -> r x y Source # | |
QFunctor (HomQ p :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
QMonad (HomQ p :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
QPointed (HomQ p :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Functor |
data ReflQ r x y where Source #
A term in ReflQ r x y
observes the equality x ~ y
.
ReflQ ()
is the discrete category.
Instances
QMonoidal (ComposeQ :: (k -> k -> Type) -> (k -> k -> Type) -> k -> k -> Type) (ReflQ () :: k -> k -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qintro1 :: p x y -> ComposeQ (ReflQ ()) p x y Source # qintro2 :: p x y -> ComposeQ p (ReflQ ()) x y Source # qelim1 :: ComposeQ (ReflQ ()) p x y -> p x y Source # qelim2 :: ComposeQ p (ReflQ ()) x y -> p x y Source # qassoc :: ComposeQ (ComposeQ p q) r x y -> ComposeQ p (ComposeQ q r) x y Source # qdisassoc :: ComposeQ p (ComposeQ q r) x y -> ComposeQ (ComposeQ p q) r x y Source # | |
Monoid m => Category (ReflQ m :: k -> k -> Type) Source # | |
Eq r => Eq (ReflQ r x y) Source # | |
Ord r => Ord (ReflQ r x y) Source # | |
Show r => Show (ReflQ r x y) Source # | |
data ComposeQ p q x z Source #
Compose quivers along matching source and target.
ComposeQ (p y z) (q x y) |
Instances
QBifunctor (ComposeQ :: (k1 -> k3 -> Type) -> (k2 -> k1 -> Type) -> k2 -> k3 -> Type) Source # | |
QClosed (ComposeQ :: (k3 -> k1 -> Type) -> (k2 -> k3 -> Type) -> k2 -> k1 -> Type) (LeftQ :: (k2 -> k3 -> Type) -> (k2 -> k1 -> Type) -> k3 -> k1 -> Type) (RightQ :: (k3 -> k1 -> Type) -> (k2 -> k1 -> Type) -> k2 -> k3 -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qlev :: ComposeQ (LeftQ p q) p x y -> q x y Source # qrev :: ComposeQ p (RightQ p q) x y -> q x y Source # qcurry :: (forall (x :: k) (y :: k). ComposeQ p q x y -> r x y) -> p x y -> LeftQ q r x y Source # quncurry :: (forall (x :: k) (y :: k). p x y -> LeftQ q r x y) -> ComposeQ p q x y -> r x y Source # qflurry :: (forall (x :: k) (y :: k). ComposeQ p q x y -> r x y) -> q x y -> RightQ p r x y Source # qunflurry :: (forall (x :: k) (y :: k). q x y -> RightQ p r x y) -> ComposeQ p q x y -> r x y Source # | |
QFunctor (ComposeQ p :: (k1 -> k2 -> Type) -> k1 -> k3 -> Type) Source # | |
QMonoidal (ComposeQ :: (k -> k -> Type) -> (k -> k -> Type) -> k -> k -> Type) (ReflQ () :: k -> k -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qintro1 :: p x y -> ComposeQ (ReflQ ()) p x y Source # qintro2 :: p x y -> ComposeQ p (ReflQ ()) x y Source # qelim1 :: ComposeQ (ReflQ ()) p x y -> p x y Source # qelim2 :: ComposeQ p (ReflQ ()) x y -> p x y Source # qassoc :: ComposeQ (ComposeQ p q) r x y -> ComposeQ p (ComposeQ q r) x y Source # qdisassoc :: ComposeQ p (ComposeQ q r) x y -> ComposeQ (ComposeQ p q) r x y Source # | |
Category p => QMonad (ComposeQ p :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Category p => QPointed (ComposeQ p :: (k1 -> k2 -> Type) -> k1 -> k2 -> Type) Source # | |
Defined in Data.Quiver.Functor | |
(Category p, p ~ q) => Category (ComposeQ p q :: k -> k -> Type) Source # | |
(forall (y :: k2). Show (p y z), forall (y :: k2). Show (q x y)) => Show (ComposeQ p q x z) Source # | |
(Category p, p ~ q, x ~ y) => Semigroup (ComposeQ p q x y) Source # | |
(Category p, p ~ q, x ~ y) => Monoid (ComposeQ p q x y) Source # | |
newtype LeftQ p q x y Source #
Instances
QProfunctor (LeftQ :: (k1 -> k2 -> Type) -> (k1 -> k3 -> Type) -> k2 -> k3 -> Type) Source # | |
QClosed (ComposeQ :: (k3 -> k1 -> Type) -> (k2 -> k3 -> Type) -> k2 -> k1 -> Type) (LeftQ :: (k2 -> k3 -> Type) -> (k2 -> k1 -> Type) -> k3 -> k1 -> Type) (RightQ :: (k3 -> k1 -> Type) -> (k2 -> k1 -> Type) -> k2 -> k3 -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qlev :: ComposeQ (LeftQ p q) p x y -> q x y Source # qrev :: ComposeQ p (RightQ p q) x y -> q x y Source # qcurry :: (forall (x :: k) (y :: k). ComposeQ p q x y -> r x y) -> p x y -> LeftQ q r x y Source # quncurry :: (forall (x :: k) (y :: k). p x y -> LeftQ q r x y) -> ComposeQ p q x y -> r x y Source # qflurry :: (forall (x :: k) (y :: k). ComposeQ p q x y -> r x y) -> q x y -> RightQ p r x y Source # qunflurry :: (forall (x :: k) (y :: k). q x y -> RightQ p r x y) -> ComposeQ p q x y -> r x y Source # | |
QFunctor (LeftQ p :: (k2 -> k1 -> Type) -> k3 -> k1 -> Type) Source # | |
p ~ q => Category (LeftQ p q :: k2 -> k2 -> Type) Source # | |
(p ~ q, x ~ y) => Semigroup (LeftQ p q x y) Source # | |
(p ~ q, x ~ y) => Monoid (LeftQ p q x y) Source # | |
newtype RightQ p q x y Source #
Instances
QProfunctor (RightQ :: (k3 -> k1 -> Type) -> (k2 -> k1 -> Type) -> k2 -> k3 -> Type) Source # | |
QClosed (ComposeQ :: (k3 -> k1 -> Type) -> (k2 -> k3 -> Type) -> k2 -> k1 -> Type) (LeftQ :: (k2 -> k3 -> Type) -> (k2 -> k1 -> Type) -> k3 -> k1 -> Type) (RightQ :: (k3 -> k1 -> Type) -> (k2 -> k1 -> Type) -> k2 -> k3 -> Type) Source # | |
Defined in Data.Quiver.Bifunctor qlev :: ComposeQ (LeftQ p q) p x y -> q x y Source # qrev :: ComposeQ p (RightQ p q) x y -> q x y Source # qcurry :: (forall (x :: k) (y :: k). ComposeQ p q x y -> r x y) -> p x y -> LeftQ q r x y Source # quncurry :: (forall (x :: k) (y :: k). p x y -> LeftQ q r x y) -> ComposeQ p q x y -> r x y Source # qflurry :: (forall (x :: k) (y :: k). ComposeQ p q x y -> r x y) -> q x y -> RightQ p r x y Source # qunflurry :: (forall (x :: k) (y :: k). q x y -> RightQ p r x y) -> ComposeQ p q x y -> r x y Source # | |
QFunctor (RightQ p :: (k1 -> k3 -> Type) -> k1 -> k2 -> Type) Source # | |
p ~ q => Category (RightQ p q :: k1 -> k1 -> Type) Source # | |
(p ~ q, x ~ y) => Semigroup (RightQ p q x y) Source # | |
(p ~ q, x ~ y) => Monoid (RightQ p q x y) Source # | |