Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b

Tony Morris tonymorris at gmail.com
Thu Mar 30 22:22:51 UTC 2017


But length is not a bad name. The length of ((,) a) is exactly one. It's
because people keep calling this "the tuple instance", unaware that it
is not the tuple instance. It is a conflation in vocabulary, leading to
a misunderstanding of concepts and subsequent practical application.

Jakub Daniel is exactly right, "It is categorically valid to view (a,-)
as a functor. It is no different from 0 being an integer"

Is 0 an integer? Is ((,) a) a functor? Is the length of ((,) a) equal to
one?

Whichever universe you choose to live in, these questions all have the
same answer. I would respect the contrary position more if it was also
argued that 0 is not an integer.


On 31/03/17 07:53, Theodore Lief Gannon wrote:
> Two bits from the peanut gallery:
>
> We have an open world of universal instances. The question is not
> whether it's convenient to have these instances. It's whether there's
> any likelihood of someone deciding to define them elsewhere if they're
> not in base. Because then they exist anyway, and without nearly as
> much discussion and refinement.
>
> Yes, it's an unfortunate situation. Yes, "length" is a bad name. But
> the realities of the Haskell ecosystem dictate that when a single
> lawful instance of a base typeclass exists for a base data type,
> implementing it is pretty much mandatory.
>
> On Thu, Mar 30, 2017 at 2:36 PM, Bryan Richter <b at chreekat.net
> <mailto:b at chreekat.net>> wrote:
>
>     On Thu, Mar 30, 2017 at 11:18:10PM +0200, Henning Thielemann wrote:
>     >
>     > On Thu, 30 Mar 2017, Bryan Richter wrote:
>     >
>     > >My intuition, based on observed usage in Haskell and elsewhere, is
>     > >that tuples are used as anonymous product types. Thus, I am
>     > >interested in the rationale for making them Functors because I feel
>     > >it has denied me a common, valuable tool. I no longer feel that I
>     > >should use pairs as product types. By making "(,) a" a Functor,
>     it is
>     > >no longer an anonymous product type —— it is an anonymous
>     Reader. Are
>     > >anonymous Readers really all that much more valuable than anonymous
>     > >product types? I cannot conceive it. I must be missing something.
>     >
>     > Pairs as functors are Writers. The function type got a Functor
>     > instance that corresponds to Readers.
>
>     Oops, laziness of the bad sort on my own part. :)
>
>     > I think the only reason is that some programmers got "laziness"
>     wrong
>     > and try to use primitive types for everything instead of using (and
>     > importing) dedicated types.
>
>     Well, is there anything to be done for it at this point? Is there even
>     any consensus that this was, in retrospect, a poor choice?
>
>     _______________________________________________
>     Libraries mailing list
>     Libraries at haskell.org <mailto:Libraries at haskell.org>
>     http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>     <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/20170331/0b298747/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170331/0b298747/attachment.sig>


More information about the Libraries mailing list