Diagonally in Data.Bimap

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Diagonally in Data.Bimap

Gabor Greif-2

Just searched for a `bimap` variant that simultaneously transforms
both components with the same morphism:

``` haskell
diag :: Bifunctor p => (a -> b) -> p a a -> p b b
diag f = bimap f f

I did not find any. Would it make sense to add it?



PS: same for profunctors:

``` haskell
xmap :: Profunctor p => (a -> b) -> p b a -> p a b
PPS: I would have sent this to [hidden email] but it seem to be
closed group.
ghc-devs mailing list
[hidden email]