The RHS of the RULE for filterFB confuses p and q, which can be shown
as follows:

filterFB is defined as follows:

   filterFB c p x r | p x       = x `c` r
                    | otherwise = r

which is equivalent to

   filterFB c p x r = if p x then c x r else r

(&&) is defined as follows

   True  && x = x
   False && _ = False

which implies that

   if a && b then c else d

is equivalent to

   if a then (if b then c else d) else d

Now we can deduce

     filterFB (filterFB c p) q a b
   = if q a then filterFB c p a b else b
   = if q a then (if p a then c a b else b) else b
   = if q a && p a then c a b else b
   = filterFB c (\x -> q x && p x) a b

which is *not* equivalent to

     filterFB c (\x -> p x && q x) a b

Adventurous people can fix this this without recompilation by
hand-editing PrelList.hi: Search for "filterFB" near the end of the
file and flip p and q in the RHS. For more timid people: I'm checking
in a fixed version of PrelList.lhs.   :-)


Cheers,
   Sven

Reply via email to