Open masaeedu opened 3 years ago
Should it be rather
contraverse :: Divisible f => (a -> f b) -> t a -> f (t b)
etc?
It is not.
But it is useful. A HKD-flavoured version might be worth proposing in one of the various HKD libraries, because it gives you a good story for using Divisible
with records: https://discourse.haskell.org/t/hasql-inserting-many-values-that-arent-tuples/10799/4
A rank-1 version would be useful, as @masaeedu says, and also provide an intuition to help people reading about a HKD version.
Hello there. I find it very nice to have an analog for
Applicative
forContravariant
functors. But it feels like something is missing; where are our niceTraversable
s?It seems like there is room for a typeclass like this:
A simple application is to note that finite products (e.g.
Vec n
) areContraversable
. Thus theconsequence
of a container-ful ofPredicate
sconditions :: Vec n (Predicate a)
isconsequence conditions :: Predicate (Vec n a)
, a predicate that gives the conjunction of the result of each predicate inconditions
. Similarly, a finite productful of flipped folds can beconsequence
d to a flipped fold over the product. etc. etc.Would you be open to a PR that adds this typeclass?