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

Theodore Lief Gannon tanuki at gmail.com
Thu Mar 30 21:53:14 UTC 2017


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> 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
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20170330/c6d775b2/attachment.html>


More information about the Libraries mailing list