Constraints on definition of `length` should be strengthened
Henrik Nilsson
Henrik.Nilsson at nottingham.ac.uk
Sun Apr 9 00:29:43 UTC 2017
On 04/09/2017 12:51 AM, Nathan Bouscal wrote:
> - You're trying to establish an analogy between these tuple instances
> and non-law-abiding instances, but that analogy really doesn't work.
> These are the only law-abiding instances that the types can possibly have.
Yes. But that is, actually, more of a syntactic accident than any deeply
mathematical property: mathematically, there are n ways to make an
n-tuple a functor,
And if we, for "consistency", continue to add functor instances for
tuples for n > 2, the situation, in the view of many reasonable
people at least, becomes increasingly absurd, or at least it becomes
increasingly clear that that the utility we get is a smaller and
smaller part of what we really need. Simply because tuples actually
are "morally unbiased", as Vladislav Zavialov phrased it; i.e.,
there are perfectly legitimate uses where the fields are of equal
importance: there is no a priori "pay load" field, and no a priori
"annotation" fields. And in fact, that is *exactly* what tuples
originally were in Haskell, and how many very reasonably people
still prefers to think about them.
And of course, if, in a hypothetical future version of Haskell
where we could make all possible functor instances for tuples,
the question becomes: which one do we pick? The answer might well
be "none" (in the prelude, at least). (A newtype wrapper approach, e.g.
a la numeric Monid instances, would be both unpalatable and ultimately
pointless.)
So, in summary, I'd find the argument for the present tuple instances
much more compelling if it *mathematically* were the case that the
only law-abiding instances are those ones. But that is not the case.
Best,
/Henrik
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it.
Please do not use, copy or disclose the information contained in this
message or in any attachment. Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.
This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.
More information about the Libraries
mailing list