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

Andreas Abel abela at chalmers.se
Sat Apr 1 07:24:11 UTC 2017


 > The length of ((,) a) is exactly one. Anything else is ridiculous.

Now we are even talking of the length of a function.  Can it get more 
absurd?!

It is perfectly to limit the concept of "length" to

* linear structures (lists, arrays, etc.)
   [branching structures do not have a length, they may have a size or 
maximum depth]

* which have variable length
   [why would you otherwise ask for the length?]

Thus, the following answers of ghci are highly questionable, (and for 
the non-washed brain, simply non-sensical).

Prelude> length (Left 100)
0
Prelude> length (Right 200)
1

Just make a field experiment.  Go to the mathematics department and ask 
people what is the length of (1, 1), the length of (1, 1, 1).  An then 
count the number of people that respond "1" to both of these questions. 
And weight it against the people that say something else.

On 01.04.2017 03:27, Tony Morris wrote:
> I did read it. I chose not to respond. I do not believe it to be a
> constructive avenue.
>
> I am repeating myself far less than the misunderstanding and
> inconsistency around "tuples." To this end, I believe is worthwhile to
> continue pointing out the inconsistency, and only slightly less so than
> those who hold a contrary inconsistent position, who are inadvertently
> pointing out the inconsistency. 0 is not an integer is a statement of
> equal validity, buit more obviously not so.
>
> If I see "length of tuples", and related misunderstandings and
> subsequent misrepresentations some number of times, I will respond
> proportionally. I expect I will see it again in the very near future. I
> will point to that mistake on the occasion. I hope that is OK.
>
> The length of ((,) a) is exactly one. Anything else is ridiculous. Try
> arguing against that, instead of a position that does not exist ("length
> of tuples"). I wrote this instance some number of years ago (about 11),
> and have used it on teams all over the place. Not once was there an
> issue that was not quickly corrected, and thereby achieving the
> practical benefits that come with, by providing a better understanding.
> That understanding is above. The length of ((,) a) is exactly one. Say
> it with me.
>
>
> On 01/04/17 10:08, Francesco Ariis wrote:
>> On Sat, Apr 01, 2017 at 07:59:00AM +1000, Tony Morris wrote:
>>> A contrary, consistent position would mean there is a belief in all of
>>> the following:
>>>
>>> * the length of any value of the type ((,) a) is not 1
>>> * 0 is not an integer
>> You keep repeating the same message, I wonder if you read the reply that
>> have been sent to you. From the other thread (in which, after a brief
>> threat to fork the compiler, you asked for explanations), Artyom
>> Kazak kindly answered:
>>
>>> Okay, I have to admit that in this particular instance it's not quite my
>>> intuition which causes the pain. Or rather, it's a different kind of
>>> intuition, which I have acquired from Haskell in particular – "I don't have
>>> to be particularly careful about minor refactorings, because if I change
>>> the type of one thing, the compiler will tell me what other things I have
>>> to change if I want to preserve the logic of my code". The behavior of
>>> 'length' breaks this intuition because "I'll just pass a tuple here instead
>>> of whatever I used before" stops being a (relatively) safe refactoring.
>> No mention of it being "categorically invalid".
>>
>> Moreover, the message you are replying to now (by Svan Penne) is clearly
>> illustrates the dichotomy between *type safety* and *consistency*.
>> Surely everyone (despite their ideas and preferred outcome) can see the
>> two competing interests?
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> 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
>


-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Department of Computer Science and Engineering
Chalmers and Gothenburg University, Sweden

andreas.abel at gu.se
http://www.cse.chalmers.se/~abela/


More information about the Libraries mailing list