I seem to be doing a pretty poor job of communicating my point and should maybe quit while I'm ahead, but one more go:

I agree that it is good practice to create proper data types rather than using tuples everywhere. I agree with this even more strongly if you're in a 100kloc codebase. It sounds like that's the use case that you're deeply familiar with, Andreas, and it sounds like you've come to correct conclusions in that context.

My argument is that there exist other contexts, that you are less familiar with those contexts, and that you should not necessarily expect your experience to fully generalize.

You're qualified to say that in 100kloc codebases, tuples should exclusively be used for returning multiple values from functions. In that context it's clear that Functor isn't helpful.

What you seem to be saying, though, is one of two things.
  1: "In all contexts, you should only ever use tuples for this purpose", or
  2: "If you find another purpose to use tuples for, you shouldn't use them as Functors"

Option 1 requires you to assume that your work on 100kloc codebases generalizes to every use-case of the Haskell programming language. That's pretty bold, especially given that there clearly exist use-cases for which your two stated benefits (readability and maintainability) don't really matter (e.g. writing throwaway scripts).

Option 2 is more humble in that it allows for the possibility that there's a use-case you're unfamiliar with, but instead it just makes an arbitrary decision that, whatever this unfamiliar use-case is, surely they shouldn't be using Functor. I don't see any way to justify that position.

---

I don't find anything strange about `minimum (1,2) == 2`, any more than I would find it strange that `minimum (F 1 2) == 2` for any other arbitrary F. I think it's really beside the point, though.

On Wed, Feb 24, 2016 at 9:04 AM, Simon Peyton Jones <simonpj@microsoft.com> wrote:
|  So, my advice is to use tuples only for very short-lived data, like
|  returning multiple results from a function.

I strongly agree, for all the reasons Andreas mentions.  GHC's source code has *lots* of data types that are isomorphic to tuples.  Crucial!

Simon

|  -----Original Message-----
|  From: Libraries [mailto:libraries-bounces@haskell.org] On Behalf Of
|  Andreas Abel
|  Sent: 24 February 2016 08:58
|  To: Nathan Bouscal <nbouscal@gmail.com>; libraries@haskell.org
|  Subject: Re: Haskell Foldable Wats
|
|  In my n+1 years of participating in a 100kloc Haskell project, I
|  learned that programming with the "categorical" data type building
|  blocks "Either" and tuples leads to code that is hard to read and
|  maintain.  It is tempting to use a pair
|
|     type QNamed a = (QName, a)
|
|  instead of a hand-rolled data type
|
|     data QNamed a = QNamed { qname :: QName, qnamedThing :: a }
|
|  since with pairs, I get lots of operations for free, and even more if I
|  use Functor and Traversable, it seems.  However, in the long run, if I
|  come back after months to my original code, or even worse, to someone
|  else's code, I dearly pay for this:
|
|     1. Harder to read the code, as I may only see the non-telling "fst"
|  and "snd" instead of the semantics-loaden "qname" and "qnamedThing".
|
|     2. Lack of code exploration facilities like grep and tags.  I can
|  grep for "QName" and "qname", but grepping for "," and "fst" returns
|  lots of irrelevant locations.
|
|     3. Non-telling error messages.
|
|  And all the arguments of using newtypes over type synonyms apply here
|  as well.
|
|  So, my advice is to use tuples only for very short-lived data, like
|  returning multiple results from a function.  I am speaking here of
|  Haskell as a language for software development, not of Haskell as a
|  realization of category theory.
|
|  For getting a broader acceptance of Haskell as a language for software
|  development, Foldable on tuples is not helpful.
|
|  And yes, if I was new to Haskell and learned the GHCI thinks that
|
|     minimum (1,2) == 1
|
|  then I would advice GHCI to visit some mental institution to get its
|  delusions fixed.
|
|  --Andreas
|
|
|  On 23.02.2016 18:29, Nathan Bouscal wrote:
|  > Sorry, poor quoting on my part. I was attempting to reply to
|  Andreas's
|  > earlier points:
|  >
|  >  >> Use of tuples is highly discourageable…
|  >>>I see no point in Functor or Foldable for tuples.
|  >
|  > On Tue, Feb 23, 2016 at 5:18 PM, Mario Blažević <mblazevic@stilo.com
|  > <mailto:mblazevic@stilo.com>> wrote:
|  >
|  >     On 16-02-23 11:23 AM, Nathan Bouscal wrote:
|  >
|  >         It's a bit bold to simultaneously say "Nobody should use this
|  >         type," and
|  >         also "If you use this type, you should do it this way." If
|  you think
|  >         that it's bad practice to use tuples, that's a fine and
|  respectable
|  >         opinion, but at that point you should start being a bit more
|  >         wary about
|  >         telling those who think otherwise /how/ they should use them.
|  >
|  >
|  >              I believe he was referring to lists, not to tuples.
|  There
|  >     were  few Prelude functions limited to tuples before FTP, and
|  those
|  >     haven't changed.
|  >
|  >
|  >
|  >         On Tue, Feb 23, 2016 at 1:10 PM, Marcin Mrotek
|  >         <marcin.jan.mrotek@gmail.com
|  >         <mailto:marcin.jan.mrotek@gmail.com>
|  >         <mailto:marcin.jan.mrotek@gmail.com
|  >         <mailto:marcin.jan.mrotek@gmail.com>>> wrote:
|  >
|  >              > I can assure you that Andreas is not delusional
|  >
|  >              I didn't say that. I was referring to his response to my
|  >         post, that
|  >              "Some delusions have very sophisticated explanations."
|  >
|  >              > You have to show good taste or you'll end up with a
|  mess
|  >         that might be logically consistent, but unpleasant to use.
|  >
|  >              This is entirely subjective, and frankly I don't think
|  that
|  >         post-FTP
|  >              Haskell is a "mess" or is "unpleasant to use". If
|  anything,
|  >         it became
|  >              more useful to me, because now Prelude functions aren't
|  >         limited to the
|  >              one data structure I almost never use.
|  >
|  >              Best regards,
|  >              Marcin Mrotek
|  >
|  >
|  >     _______________________________________________
|  >     Libraries mailing list
|  >     Libraries@haskell.org <mailto:Libraries@haskell.org>
|  >
|  >
https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.h
|  > askell.org%2fcgi-
|  bin%2fmailman%2flistinfo%2flibraries&data=01%7c01%7cs
|  >
|  imonpj%40064d.mgd.microsoft.com%7ce4033ee9a03a42eaa97108d33cf89187%7c7
|  >
|  2f988bf86f141af91ab2d7cd011db47%7c1&sdata=hgiQqaz1dUG2aUrmeYETcy6loEMf
|  > xosR3yBA09CQaZs%3d
|  >
|  >
|  >
|  >
|  > _______________________________________________
|  > Libraries mailing list
|  > Libraries@haskell.org
|  >
https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.h
|  > askell.org%2fcgi-
|  bin%2fmailman%2flistinfo%2flibraries&data=01%7c01%7cs
|  >
|  imonpj%40064d.mgd.microsoft.com%7ce4033ee9a03a42eaa97108d33cf89187%7c7
|  >
|  2f988bf86f141af91ab2d7cd011db47%7c1&sdata=hgiQqaz1dUG2aUrmeYETcy6loEMf
|  > xosR3yBA09CQaZs%3d
|  >
|
|
|  --
|  Andreas Abel  <><      Du bist der geliebte Mensch.
|
|  Department of Computer Science and Engineering Chalmers and Gothenburg
|  University, Sweden
|
andreas.abel@gu.se
https://na01.safelinks.protection.outlook.com/?url=http:%2f%2fwww2.tcs.
ifi.lmu.de%2f~abel%2f&data=01%7C01%7Csimonpj%40064d.mgd.microsoft.com%7
|  Ce4033ee9a03a42eaa97108d33cf89187%7C72f988bf86f141af91ab2d7cd011db47%7C
|  1&sdata=kvwlaXofxhQV2ZCD9K%2bemtG4S9oCujNYhn1IXTnSZtc%3d
|  _______________________________________________
|  Libraries mailing list
Libraries@haskell.org
https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.ha
skell.org%2fcgi-
|  bin%2fmailman%2flistinfo%2flibraries%0a&data=01%7c01%7csimonpj%40064d.m
gd.microsoft.com%7ce4033ee9a03a42eaa97108d33cf89187%7c72f988bf86f141af9
|  1ab2d7cd011db47%7c1&sdata=gMTA2SOTm1seAHbvHPWnsDjAa7y1gAS681kW6YUx1mQ%3
|  d