Diagonally in Data.Bimap

Gabor Greif ggreif at gmail.com
Thu Jul 5 13:36:27 UTC 2018


Hi!

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?

Cheers,

    Gabor

PS: same for profunctors:

``` haskell
xmap :: Profunctor p => (a -> b) -> p b a -> p a b
```
PPS: I would have sent this to libraries at haskell.org but it seem to be
closed group.


More information about the ghc-devs mailing list