
On Thu, Mar 30, 2017 at 08:30:32PM +0200, Henning Thielemann wrote:
On Thu, 23 Mar 2017, Fumiaki Kinoshita wrote:
It's surprising that they are missing (forgive me, I'm not here to make people grumpy).
I am not surprised because it was discussed at length a year before. I still think all these instances on pairs, triples and other tuples are more dangerous than helpful. It is so easy and much more expressive to define custom data types for your particular application.
I can't help but feel the same way. I find it detrimental that pairs have a Functor instance. I don't care that 'length' is a member of Foldable, or that anything that is a Functor can/should be Foldable —— I just don't know why pairs ever got to Functor. I fear this was an ancient decision... no? 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. And certainly somebody might argue, "Just keep using them as product types. Nothing has changed." But of course something has changed. My product now has a sharp edge. There is some extra information I have to hold in my head: "Don't put this in a Functor context and expect to be able to follow the compiler errors!" If I wanted to hold extra information in my head, surely I would go back to using Perl. I fear that pairs became Functors a long, long time ago, and now we're stuck with it. Is that true? If so, I believe that crucial fact should preface any argument about 'length', and hopefully we could agree the root cause of `length (a,b) == 1` —— if it is to be considered a problem —— is the fact that `fmap f (a,b) == (a, f b)`. For whatever my vote is worth as somebody posting to this list for the first time, -1. Thanks, -Bryan