ekmett / profunctors

Haskell 98 Profunctors
http://hackage.haskell.org/package/profunctors
Other
70 stars 43 forks source link

Implement (***), (&&&) for Strong and (+++) and (|||) for Choice #104

Closed marcosh closed 1 year ago

marcosh commented 1 year ago

Would it make sense to add implementations for (***) and (&&&) for a Strong profunctor when it is also a Category, similarly to what Purescript does?

Similarly (+++) and (|||) could be added for Choice, when it is also a Category

RyanGlScott commented 1 year ago

Just to make sure that I understand correctly, are you proposing to add top-level functions with the same type signatures as splitStrong and fanout? Or are you proposing something else?

marcosh commented 1 year ago

yes, I would like to add to the library the following functions:

(***) :: (Category p, Strong p) => p a b -> p c d -> p (a, c) (b, d)

(&&&) :: (Category p, Strong g) => p a b -> p a c -> p a (b, c)

(+++) :: (Category p, Choice p) => p a b -> p c d -> p (Either a c) (Either b d)

(|||) :: (Category p, Choice p) => p a c -> p b c -> p (Either a b) c
RyanGlScott commented 1 year ago

I'm not sure how I feel about giving them the same names as Arrow's class methods, as that could possibly be confusing. I think I would prefer explicit names, such as the ones that purescript uses. Otherwise, I have no objection to adding these.

marcosh commented 1 year ago

agreed that the naming could be confusing. I'll create a PR with explicit names