What is the name used in literature and libraries for the abstraction of "zero profunctors"

184 views Asked by At

In real world application I noticed a pattern that could be generalized to something like:

purescript:

class Profunctor p <= Zero p where
  pzero :: forall a b. p a b -- such that `forall f g. dimap f g pzero == pzero`

It seems basic enough to have its own name in literature and libraries out there. So what is its name? (Zero and pzero are made up by me.)

UPDATE

I realized I made wrong generalization. My real world data type could provide infinitely many pzero implementations while what I really meant was a unique pzero that was identity for psum :: forall a b . p a b -> p a b -> p a b. So what I was looking a name for was rather:

purescript:

class Profunctor p <= Sum p where
  psum :: forall a b . p a b -> p a b -> p a b -- such that `psum a (psum b c) == psum (psum a b) c

class (Profunctor p, Sum p) <= Zero p where
  pzero :: forall a b. p a b -- such that `psum pzero p == p == psum p pzero`

(possibly without Profunctor p constrain).

This looks like a dual of Product Profunctor so I would call it Sum Profunctor, unless the literature and libraries discovered it already under a different name.

2

There are 2 answers

2
finn balor On

In literature and libraries, the abstraction of "zero profunctors" is commonly referred to as "identity profunctors." These are profunctors that are the identity on objects, meaning they map every object to itself and every arrow to itself.

0
Max New On

Your definition looks like what you want is a monoid in the Cartesian monoidal category of profunctors. This is quite similar (though not dual) to Product profunctors which are monoids wrt a different monoidal structure: the Day convolution.

As for naming, this is the analog of MonadPlus so I would probably go with ProfunctorPlus to match that