Is there a function \x -> (x, x) in standard libraries?

Elliot Cameron eacameron at gmail.com
Wed Jul 24 14:20:42 UTC 2019


-1

We already have a 'dup' function defined in base but it does something
completely different. I see no reason to add a mild abbreviation and force
Haskellers to add yet another silly word to their vocabulary. Library
authors can already create their own set of vocabulary by importing a
common internal module. Base doesn't need to get involved.

On Wed, Jul 24, 2019 at 10:06 AM Cale Gibbard <cgibbard at gmail.com> wrote:

> The advantage of (\x->(x,x)) as a name is that for a small number of
> additional characters, the meaning is obvious even if you didn't know
> that this thing existed before, and it generalises nicely -- to other
> tuples, or a change from using pairs to some other data structure.
>
> Now, I would actually support the idea of having a type class for
> categories with such a diagonal map. But this already exists:
>
>
> http://hackage.haskell.org/package/categories-1.0.7/docs/Control-Category-Cartesian.html
> -- See 'diag'.
>
> One thing I think would be really nice is for the proc/do (Arrow)
> notation to be defined in terms of the stuff which is currently in the
> 'categories' package, which ultimately might mean blessing that stuff
> a little more. Of course, Conal has also experimented with
> interpreting lambdas in terms of similar classes of operations, which
> is an extremely powerful idea as well.
>
> On Wed, 24 Jul 2019 at 09:54, Vladislav Zavialov <vladislav at serokell.io>
> wrote:
> >
> > map (\x->(x,x)) is quite a punctuation soup compared to ‘map dup’.
> >
> > - Vlad
> >
> > > On 24 Jul 2019, at 16:48, Cale Gibbard <cgibbard at gmail.com> wrote:
> > >
> > > Does lambda not exist for a reason?
> > > _______________________________________________
> > > Libraries mailing list
> > > Libraries at haskell.org
> > > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
> >
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20190724/c07ed502/attachment.html>


More information about the Libraries mailing list