[Haskell-cafe] Textbook example of instance Foldable ((,) a)
Manuel Schneckenreither
manuel.schnecki at gmail.com
Mon Nov 23 15:00:42 UTC 2020
>>>>> "SP" == Sven Panne <svenpanne at gmail.com> writes:
SP> Am Mo., 23. Nov. 2020 um 14:54 Uhr schrieb Johannes Waldmann
SP> <johannes.waldmann at htwk-leipzig.de>: [...] Henning already
SP> called this "Matlab league" behaviour,
SP> https://mail.haskell.org/pipermail/libraries/2016-February/026678.html
What is the intiutive way of implementing the tuple instance like this [1]
instance Foldable ((,) a) where
..
length _ = 1
..
I cannot come up with a real argument, except to say there is something.
For instance for Either, Left returns 0, and Right 1. But that there is
something isn't that already implied by the tuple? And even if that
would be the argument, the ⊥-case is not considered as the argument is
not evaluated.
[1] https://hackage.haskell.org/package/base-4.14.0.0/docs/src/Data.Foldable.html#line-363
More information about the Haskell-Cafe
mailing list