
Hi, Am Freitag, den 19.09.2014, 22:29 +0200 schrieb Henning Thielemann:
Unfortunately, it is not only hard to predict when RULES fire, a RULES based solution is also dangerous. If a default method implementation and an actual instance implementation do different things, that's ok. In contrast, if a function is replaced by different functionality via RULES, that's very bad.
I meant rules provided by whoever implements the class: instance Traversable Foo where.. {-# RULES "sum/Foo" forall fx :: Foo Int . sum (toList fx) = sumFoo xs #-} so there would be no worry about soundness. I do _not_ mean adding such rules to where the class is defined. (This assumes that GHC does the right thing when the overloaded toList occurs in a rule, which I am not sure of.) 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