Stable location for monomorphic foldr?

Hi, I just stumbled over a FTP breakage: A RULES with "foldr" on the left hand side would no longer fire, because it would refer to Foldable.foldr, and not the monomorphic foldr. Adding #if MIN_VERSION_base(4,8,0) import Prelude hiding (foldr) import GHC.OldList (foldr) #endif to the file solved the problem for now, but GHC.OldList is supposed to go away eventually, so I believe we need a permanent location for the monomorphic foldr. Or will we simply not get rid of GHC.OldList at all? (One could argue that "foldr" on the left-hand-side of a RULE should work and that this is a GHC bug, though.) Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org

The culprit seems to be that
instance Foldable [] where
elem = List.elem foldl = List.foldl foldl' =
List.foldl' foldl1 = List.foldl1 foldr = List.foldr foldr1
= List.foldr1 length = List.length maximum = List.maximum
minimum = List.minimum null = List.null product =
List.product sum = List.sum toList = id
delegates to monomorphic methods rather than implementing them directly.
The early testing where we showed that it didn't break RULES was done with
the final definitions in the class rather than delegating to GHC.OldList.
Somewhere when reorganizing of the code we switched to this style and
introduced this problem, making RULES much more brittle. =/
-Edward
On Wed, Apr 1, 2015 at 7:14 AM, Joachim Breitner
Hi,
I just stumbled over a FTP breakage: A RULES with "foldr" on the left hand side would no longer fire, because it would refer to Foldable.foldr, and not the monomorphic foldr.
Adding #if MIN_VERSION_base(4,8,0) import Prelude hiding (foldr) import GHC.OldList (foldr) #endif to the file solved the problem for now, but GHC.OldList is supposed to go away eventually, so I believe we need a permanent location for the monomorphic foldr.
Or will we simply not get rid of GHC.OldList at all?
(One could argue that "foldr" on the left-hand-side of a RULE should work and that this is a GHC bug, though.)
Greetings, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries

Hi, Am Mittwoch, den 01.04.2015, 13:14 +0200 schrieb Joachim Breitner:
I just stumbled over a FTP breakage: A RULES with "foldr" on the left hand side would no longer fire, because it would refer to Foldable.foldr, and not the monomorphic foldr.
Adding #if MIN_VERSION_base(4,8,0) import Prelude hiding (foldr) import GHC.OldList (foldr) #endif to the file solved the problem for now, but GHC.OldList is supposed to go away eventually, so I believe we need a permanent location for the monomorphic foldr.
in (accidentally?) private communication, Herbert suggested to use GHC.List, which also exports foldr. GHC.List does not show up in the haddock index, but does exist, and is likely to stay. Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org
participants (2)
-
Edward Kmett
-
Joachim Breitner