So what should maximum (2, "potato") be?

On Mon, Nov 23, 2020, 14:19 Sven Panne <svenpanne@gmail.com> wrote:
Am Mo., 23. Nov. 2020 um 16:32 Uhr schrieb Sebastiaan Joosten <sjcjoosten+haskell@gmail.com>:
[...] We obtain: length (a,b) = length [b] = 1

Quoting my former self (https://mail.haskell.org/pipermail/libraries/2017-April/027905.html), you get even more "fun" stuff with lots of potential for late-night debugging hours:
   maximum (3,2)   =>   2
   minimum (4,5)   => 5
   sum (6,7)   =>   7
   product (8,9)   =>   9
Yes, you can think of (X, Y) as "Y with context X" or "a one-element container with Y in it", but is this really what comes to your mind first? I still highly doubt that. The Foldable-Traversable-in-Prelude change was largely a good thing, but very surprising (and not really needed) changes coming stealthily with it were only communicated when it was already too late... :-/
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.