Re: Diagonally in Data.Bimap

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

Re: Diagonally in Data.Bimap

Joachim Breitner-2
Hi

Am Donnerstag, den 05.07.2018, 15:36 +0200 schrieb Gabor Greif:

> 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?
possibly, I have wanted it too before.

Bikeshedding:
I’d have expected the name “both”. It also has precedence here:
http://hackage.haskell.org/package/extra/docs/Data-Tuple-Extra.html#v:both
http://hackage.haskell.org/package/concatenative/docs/Control-Concatenative.html#v:both
http://hackage.haskell.org/package/MissingK/docs/Control-Arrow-Extra.html#v:both
http://hackage.haskell.org/package/lens-family/docs/Lens-Family2-Stock.html#v:both
http://hackage.haskell.org/package/lens/docs/Control-Lens-Traversal.html#v:both

Diagonally sounds more like something of type `a -> (a,a)` or similar.

> PPS: I would have sent this to [hidden email] but it seem to be
> closed group.

It should not. Maybe only open to subscribers? (A common crude anti-
spam measurement.)

Cheers,
Joachim


--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Diagonally in Data.Bimap

pedro neves
Hello All,

Can you please remove me from this e-mail string ...

I don't know how I got added ... Thank you.

On Thu, Jul 5, 2018 at 11:10 AM Joachim Breitner <[hidden email]> wrote:
Hi

Am Donnerstag, den 05.07.2018, 15:36 +0200 schrieb Gabor Greif:
> 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?

possibly, I have wanted it too before.

Bikeshedding:
I’d have expected the name “both”. It also has precedence here:
http://hackage.haskell.org/package/extra/docs/Data-Tuple-Extra.html#v:both
http://hackage.haskell.org/package/concatenative/docs/Control-Concatenative.html#v:both
http://hackage.haskell.org/package/MissingK/docs/Control-Arrow-Extra.html#v:both
http://hackage.haskell.org/package/lens-family/docs/Lens-Family2-Stock.html#v:both
http://hackage.haskell.org/package/lens/docs/Control-Lens-Traversal.html#v:both

Diagonally sounds more like something of type `a -> (a,a)` or similar.

> PPS: I would have sent this to [hidden email] but it seem to be
> closed group.

It should not. Maybe only open to subscribers? (A common crude anti-
spam measurement.)

Cheers,
Joachim


--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/
_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Reply | Threaded
Open this post in threaded view
|

Re: Diagonally in Data.Bimap

John Wiegley-2
You've been unsubscribed from the libraries list.

John


On Thu, Jul 5, 2018, at 4:39 PM, pedro neves wrote:
Hello All,

Can you please remove me from this e-mail string ...

I don't know how I got added ... Thank you.

On Thu, Jul 5, 2018 at 11:10 AM Joachim Breitner <[hidden email]> wrote:
Hi

Am Donnerstag, den 05.07.2018, 15:36 +0200 schrieb Gabor Greif:
> 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?

possibly, I have wanted it too before.

Bikeshedding:
I’d have expected the name “both”. It also has precedence here:

Diagonally sounds more like something of type `a -> (a,a)` or similar.

> PPS: I would have sent this to [hidden email] but it seem to be
> closed group.

It should not. Maybe only open to subscribers? (A common crude anti-
spam measurement.)

Cheers,
Joachim


--
Joachim Breitner
_______________________________________________
Libraries mailing list
_______________________________________________
Libraries mailing list

_______________________________________________
Libraries mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries