vitrea-0.1.0.0: Profunctor optics via the profunctor representation theorem.

Copyright(c) Mario Román 2020
LicenseGPL-3
Maintainermromang08@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Categories

Description

Provides a definition of category enriched over Hask, where the sets of objects are represented by constraints. Considers also functors and monoidal categories.

Synopsis
  • class Category objc c where
    • unit :: objc x => c x x
    • comp :: objc x => c y z -> c x y -> c x z
  • class (Category objc c, Category objd d, forall x. objc x => objd (f x)) => VFunctor objc c objd d f where
    • map :: (objc x, objc y) => c x y -> d (f x) (f y)
  • class (Category objc c, Category objd d, Category obje e, forall x y. (objc x, objd y) => obje (f x y)) => Bifunctor objc c objd d obje e f where
    • bimap :: (objc x1, objc x2, objd y1, objd y2) => c x1 x2 -> d y1 y2 -> e (f x1 y1) (f x2 y2)
  • class (Category objc c, Category objd d) => Profunctor objc c objd d p where
    • dimap :: (objc x1, objc x2, objd y1, objd y2) => c x2 x1 -> d y1 y2 -> p x1 y1 -> p x2 y2
  • class (Category obja a, Bifunctor obja a obja a obja a o, obja i) => MonoidalCategory obja a o i where
    • alpha :: (obja x, obja y, obja z) => a (x `o` (y `o` z)) ((x `o` y) `o` z)
    • alphainv :: (obja x, obja y, obja z) => a ((x `o` y) `o` z) (x `o` (y `o` z))
    • lambda :: obja x => a (x `o` i) x
    • lambdainv :: obja x => a x (x `o` i)
    • rho :: obja x => a (i `o` x) x
    • rhoinv :: obja x => a x (i `o` x)
  • class (MonoidalCategory objm m o i, Bifunctor objm m objc c objc c f, Category objc c) => MonoidalAction objm m o i objc c f where
    • unitor :: objc x => c (f i x) x
    • unitorinv :: objc x => c x (f i x)
    • multiplicator :: (objc x, objm p, objm q) => c (f p (f q x)) (f (p `o` q) x)
    • multiplicatorinv :: (objc x, objm p, objm q) => c (f (p `o` q) x) (f p (f q x))

Documentation

class Category objc c where Source #

Definition of a category enriched over the language. The sets of objects are represented by constraints.

Methods

unit :: objc x => c x x Source #

comp :: objc x => c y z -> c x y -> c x z Source #

Instances
Monad m => Category (Algebra m :: Type -> Constraint) ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unit :: Algebra m x => x -> x Source #

comp :: Algebra m x => (y -> z) -> (x -> y) -> x -> z Source #

Category (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unit :: Any x => x -> x Source #

comp :: Any x => (y -> z) -> (x -> y) -> x -> z Source #

Monad m => Category (Any :: Type -> Constraint) (Kleisli m :: Type -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unit :: Any x => Kleisli m x x Source #

comp :: Any x => Kleisli m y z -> Kleisli m x y -> Kleisli m x z Source #

Category Functor (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unit :: Functor x => Nat x x Source #

comp :: Functor x => Nat y z -> Nat x y -> Nat x z Source #

Category Applicative (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unit :: Applicative x => Nat x x Source #

comp :: Applicative x => Nat y z -> Nat x y -> Nat x z Source #

Category Traversable (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unit :: Traversable x => Nat x x Source #

comp :: Traversable x => Nat y z -> Nat x y -> Nat x z Source #

class (Category objc c, Category objd d, forall x. objc x => objd (f x)) => VFunctor objc c objd d f where Source #

Functors.

Methods

map :: (objc x, objc y) => c x y -> d (f x) (f y) Source #

class (Category objc c, Category objd d, Category obje e, forall x y. (objc x, objd y) => obje (f x y)) => Bifunctor objc c objd d obje e f where Source #

Bifunctors.

Methods

bimap :: (objc x1, objc x2, objd y1, objd y2) => c x1 x2 -> d y1 y2 -> e (f x1 y1) (f x2 y2) Source #

Instances
Monad m => Bifunctor (Algebra m :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Algebra m x1, Algebra m x2, Any y1, Any y2) => (x1 -> x2) -> (y1 -> y2) -> (x1, y1) -> (x2, y2) Source #

Monad m => Bifunctor (Algebra m :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Algebra m :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Algebra m :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Algebra m x1, Algebra m x2, Algebra m y1, Algebra m y2) => (x1 -> x2) -> (y1 -> y2) -> (x1, y1) -> (x2, y2) Source #

Bifunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) Either Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Any x1, Any x2, Any y1, Any y2) => (x1 -> x2) -> (y1 -> y2) -> Either x1 y1 -> Either x2 y2 Source #

Bifunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Any x1, Any x2, Any y1, Any y2) => (x1 -> x2) -> (y1 -> y2) -> (x1, y1) -> (x2, y2) Source #

Monad m => Bifunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) (Kleisli m :: Type -> Type -> Type) (Any :: Type -> Constraint) (Kleisli m :: Type -> Type -> Type) (,) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Any x1, Any x2, Any y1, Any y2) => (x1 -> x2) -> Kleisli m y1 y2 -> Kleisli m (x1, y1) (x2, y2) Source #

Bifunctor Functor (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (App :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Functor x1, Functor x2, Any y1, Any y2) => Nat x1 x2 -> (y1 -> y2) -> App x1 y1 -> App x2 y2 Source #

Bifunctor Applicative (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (App :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Applicative x1, Applicative x2, Any y1, Any y2) => Nat x1 x2 -> (y1 -> y2) -> App x1 y1 -> App x2 y2 Source #

Bifunctor Traversable (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (App :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Traversable x1, Traversable x2, Any y1, Any y2) => Nat x1 x2 -> (y1 -> y2) -> App x1 y1 -> App x2 y2 Source #

Bifunctor Functor (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Functor (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Functor (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Functor x1, Functor x2, Functor y1, Functor y2) => Nat x1 x2 -> Nat y1 y2 -> Nat (Compose x1 y1) (Compose x2 y2) Source #

Bifunctor Applicative (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Applicative (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Applicative (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Applicative x1, Applicative x2, Applicative y1, Applicative y2) => Nat x1 x2 -> Nat y1 y2 -> Nat (Compose x1 y1) (Compose x2 y2) Source #

Bifunctor Traversable (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Traversable (Nat :: (Type -> Type) -> (Type -> Type) -> Type) Traversable (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

bimap :: (Traversable x1, Traversable x2, Traversable y1, Traversable y2) => Nat x1 x2 -> Nat y1 y2 -> Nat (Compose x1 y1) (Compose x2 y2) Source #

class (Category objc c, Category objd d) => Profunctor objc c objd d p where Source #

Profunctors.

Methods

dimap :: (objc x1, objc x2, objd y1, objd y2) => c x2 x1 -> d y1 y2 -> p x1 y1 -> p x2 y2 Source #

Instances
(MonoidalAction objm m o i objc c f, MonoidalAction objm m o i objd d g, objc a, objd b) => Profunctor (objc :: k2 -> Constraint) (c :: k2 -> k2 -> Type) (objd :: k1 -> Constraint) (d :: k1 -> k1 -> Type) (Optic objc c objd d objm m o i f g a b :: k2 -> k1 -> Type) Source # 
Instance details

Defined in Tambara

Methods

dimap :: (objc x1, objc x2, objd y1, objd y2) => c x2 x1 -> d y1 y2 -> Optic objc c objd d objm m o i f g a b x1 y1 -> Optic objc c objd d objm m o i f g a b x2 y2 Source #

Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Replacing a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> (y1 -> y2) -> Replacing a b x1 y1 -> Replacing a b x2 y2 Source #

Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Aggregating a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> (y1 -> y2) -> Aggregating a b x1 y1 -> Aggregating a b x2 y2 Source #

Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Setting a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> (y1 -> y2) -> Setting a b x1 y1 -> Setting a b x2 y2 Source #

Monad m => Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Updating m a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> (y1 -> y2) -> Updating m a b x1 y1 -> Updating m a b x2 y2 Source #

Monad m => Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Classifying m a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> (y1 -> y2) -> Classifying m a b x1 y1 -> Classifying m a b x2 y2 Source #

Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Previewing a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> (y1 -> y2) -> Previewing a b x1 y1 -> Previewing a b x2 y2 Source #

Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Viewing a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> (y1 -> y2) -> Viewing a b x1 y1 -> Viewing a b x2 y2 Source #

Monad m => Profunctor (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (Any :: Type -> Constraint) (Kleisli m :: Type -> Type -> Type) (Updating m a b :: Type -> Type -> Type) Source # 
Instance details

Defined in Combinators

Methods

dimap :: (Any x1, Any x2, Any y1, Any y2) => (x2 -> x1) -> Kleisli m y1 y2 -> Updating m a b x1 y1 -> Updating m a b x2 y2 Source #

class (Category obja a, Bifunctor obja a obja a obja a o, obja i) => MonoidalCategory obja a o i where Source #

Monoidal categories. The definition follows that of an enriched monoidal category, taking the language as the base of enrichment.

Methods

alpha :: (obja x, obja y, obja z) => a (x `o` (y `o` z)) ((x `o` y) `o` z) Source #

alphainv :: (obja x, obja y, obja z) => a ((x `o` y) `o` z) (x `o` (y `o` z)) Source #

lambda :: obja x => a (x `o` i) x Source #

lambdainv :: obja x => a x (x `o` i) Source #

rho :: obja x => a (i `o` x) x Source #

rhoinv :: obja x => a x (i `o` x) Source #

Instances
Monad m => MonoidalCategory (Algebra m :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) () Source # 
Instance details

Defined in CategoriesInstances

Methods

alpha :: (Algebra m x, Algebra m y, Algebra m z) => (x, (y, z)) -> ((x, y), z) Source #

alphainv :: (Algebra m x, Algebra m y, Algebra m z) => ((x, y), z) -> (x, (y, z)) Source #

lambda :: Algebra m x => (x, ()) -> x Source #

lambdainv :: Algebra m x => x -> (x, ()) Source #

rho :: Algebra m x => ((), x) -> x Source #

rhoinv :: Algebra m x => x -> ((), x) Source #

MonoidalCategory (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) Either Void Source # 
Instance details

Defined in CategoriesInstances

Methods

alpha :: (Any x, Any y, Any z) => Either x (Either y z) -> Either (Either x y) z Source #

alphainv :: (Any x, Any y, Any z) => Either (Either x y) z -> Either x (Either y z) Source #

lambda :: Any x => Either x Void -> x Source #

lambdainv :: Any x => x -> Either x Void Source #

rho :: Any x => Either Void x -> x Source #

rhoinv :: Any x => x -> Either Void x Source #

MonoidalCategory (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) () Source # 
Instance details

Defined in CategoriesInstances

Methods

alpha :: (Any x, Any y, Any z) => (x, (y, z)) -> ((x, y), z) Source #

alphainv :: (Any x, Any y, Any z) => ((x, y), z) -> (x, (y, z)) Source #

lambda :: Any x => (x, ()) -> x Source #

lambdainv :: Any x => x -> (x, ()) Source #

rho :: Any x => ((), x) -> x Source #

rhoinv :: Any x => x -> ((), x) Source #

MonoidalCategory Functor (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity Source # 
Instance details

Defined in CategoriesInstances

MonoidalCategory Applicative (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity Source # 
Instance details

Defined in CategoriesInstances

MonoidalCategory Traversable (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity Source # 
Instance details

Defined in CategoriesInstances

class (MonoidalCategory objm m o i, Bifunctor objm m objc c objc c f, Category objc c) => MonoidalAction objm m o i objc c f where Source #

Monoidal actions as suitable bifunctors with the corresponding structure maps.

Methods

unitor :: objc x => c (f i x) x Source #

unitorinv :: objc x => c x (f i x) Source #

multiplicator :: (objc x, objm p, objm q) => c (f p (f q x)) (f (p `o` q) x) Source #

multiplicatorinv :: (objc x, objm p, objm q) => c (f (p `o` q) x) (f p (f q x)) Source #

Instances
MonoidalCategory objm m o i => MonoidalAction (objm :: k -> Constraint) (m :: k -> k -> Type) (o :: k -> k -> k) (i :: k) (objm :: k -> Constraint) (m :: k -> k -> Type) (o :: k -> k -> k) Source # 
Instance details

Defined in CategoriesInstances

Methods

unitor :: objm x => m (o i x) x Source #

unitorinv :: objm x => m x (o i x) Source #

multiplicator :: (objm x, objm p, objm q) => m (o p (o q x)) (o (o p q) x) Source #

multiplicatorinv :: (objm x, objm p, objm q) => m (o (o p q) x) (o p (o q x)) Source #

Monad m => MonoidalAction (Algebra m :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) () (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) Source # 
Instance details

Defined in CategoriesInstances

Methods

unitor :: Any x => ((), x) -> x Source #

unitorinv :: Any x => x -> ((), x) Source #

multiplicator :: (Any x, Algebra m p, Algebra m q) => (p, (q, x)) -> ((p, q), x) Source #

multiplicatorinv :: (Any x, Algebra m p, Algebra m q) => ((p, q), x) -> (p, (q, x)) Source #

Monad m => MonoidalAction (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (,) () (Any :: Type -> Constraint) (Kleisli m :: Type -> Type -> Type) (,) Source # 
Instance details

Defined in CategoriesInstances

Methods

unitor :: Any x => Kleisli m ((), x) x Source #

unitorinv :: Any x => Kleisli m x ((), x) Source #

multiplicator :: (Any x, Any p, Any q) => Kleisli m (p, (q, x)) ((p, q), x) Source #

multiplicatorinv :: (Any x, Any p, Any q) => Kleisli m ((p, q), x) (p, (q, x)) Source #

MonoidalAction Functor (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (App :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unitor :: Any x => App Identity x -> x Source #

unitorinv :: Any x => x -> App Identity x Source #

multiplicator :: (Any x, Functor p, Functor q) => App p (App q x) -> App (Compose p q) x Source #

multiplicatorinv :: (Any x, Functor p, Functor q) => App (Compose p q) x -> App p (App q x) Source #

MonoidalAction Applicative (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (App :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unitor :: Any x => App Identity x -> x Source #

unitorinv :: Any x => x -> App Identity x Source #

multiplicator :: (Any x, Applicative p, Applicative q) => App p (App q x) -> App (Compose p q) x Source #

multiplicatorinv :: (Any x, Applicative p, Applicative q) => App (Compose p q) x -> App p (App q x) Source #

MonoidalAction Traversable (Nat :: (Type -> Type) -> (Type -> Type) -> Type) (Compose :: (Type -> Type) -> (Type -> Type) -> Type -> Type) Identity (Any :: Type -> Constraint) ((->) :: Type -> Type -> Type) (App :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in CategoriesInstances

Methods

unitor :: Any x => App Identity x -> x Source #

unitorinv :: Any x => x -> App Identity x Source #

multiplicator :: (Any x, Traversable p, Traversable q) => App p (App q x) -> App (Compose p q) x Source #

multiplicatorinv :: (Any x, Traversable p, Traversable q) => App (Compose p q) x -> App p (App q x) Source #