[Haskell-cafe] Textbook example of instance Foldable ((,) a)

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Mon Nov 23 13:53:05 UTC 2020


Dear Cafe -

you might find this entertaining:
an error in my code that cost me some hours
(most Pictures are equal?)  until I finally realized

 instance Eq a => Eq (Picture a) where
   p == q = dim p == dim q
-    && all (\ i -> contents p i == contents q i) (bounds p)
+    && all (\ i -> contents p i == contents q i) (A.range $ bounds p)

Henning already called this "Matlab league" behaviour,
https://mail.haskell.org/pipermail/libraries/2016-February/026678.html

Well it's just a fun observation now, I am not implying anything. Enjoy!

- J.

Link to full source:
https://gitlab.imn.htwk-leipzig.de/autotool/all0/-/issues/660#note_24567


More information about the Haskell-Cafe mailing list