|
| |||
|
|
Applicative profunctors Just realized that non-functor profunctors can be applicative in a natural way. For example, `f` defined as f a = (a, (a, a) -> a) is a type constructor that is neither a functor nor a contrafunctor, but it looks like there is a lawful instance of applicative for f. The `pure` is defined by pure x = (x, _ -> x) The monoidal product method is defined by product :: (f a, f b) -> f (a, b) product ((xa, qa), (xb, qb)) = ((xa, xb), \((a1, b1), (a2, b2)) -> (qa (a1, a2), qb (b1, b2)) Previously I have seen that a nonconstant contrafunctor cannot have a method of type f (a, b) -> (f a, f b). So, it is not to be expected that a profunctor would have such a method either. |
||||||||||||||