proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Object

Description

Working with objects through their identity arrows: Obj a is a ~> a used as a witness that a is an object, with obj, src and tgt to produce them and the Obj/Objs pattern synonyms to recover Ob constraints from arrows and profunctor values.

Synopsis

Documentation

type Obj (a :: k) = a ~> a Source Github #

Type of identity morphism for object a.

pattern Obj :: forall k (a :: k). CategoryOf k => Ob a => Obj a Source Github #

pattern Objs :: forall {j} {k} p (a :: k) (b :: j). Profunctor p => (Ob a, Ob b) => p a b Source Github #

Matching a profunctor value p a b against Objs brings (Ob a, Ob b) into scope. This is the pattern form of (\\), handy in function equations.

obj :: forall {k} (a :: k). (CategoryOf k, Ob a) => Obj a Source Github #

The identity morphism for a given object. Compared to id this makes the kind argument implicit, allowing to write obj @a instead of id @k @a.

src :: forall {j} {k} (a :: k) (b :: j) p. Profunctor p => p a b -> Obj a Source Github #

Extract source identity morphism from a profunctor heteromorphism.

tgt :: forall {k1} {k2} (a :: k2) (b :: k1) p. Profunctor p => p a b -> Obj b Source Github #

Extract target identity morphism from a profunctor heteromorphism.

class (Ob a, CategoryOf k) => Ob' (a :: k) Source Github #

Ob as a proper class, for the positions where the type family Ob itself cannot appear, such as the head of a quantified constraint.

Instances

Instances details
(Ob a, CategoryOf k) => Ob' (a :: k) Source Github # 
Instance details

Defined in Proarrow.Core

class (CategoryOf k, forall (a :: k). Ob' a) => VacuousOb k Source Github #

A category without constraints on its objects.

Instances

Instances details
(CategoryOf k, forall (a :: k). Ob' a) => VacuousOb k Source Github # 
Instance details

Defined in Proarrow.Core

objDicts :: forall {k1} {k2} p (a :: k2) (a' :: k1). Profunctor p => p a a' -> (ObjDict a, ObjDict a') Source Github #

data ObjDict (a :: k) where Source Github #

Constructors

ObjDict :: forall {k} (a :: k). Ob a => ObjDict a