foldr/build fusion for takeWhile #9132

Add a test case and use consistent code style for the rewrite rules.  Fusion for
takeWhile improves allocations in nofib/fft2 by 19.2% and causes a regression on
nofib/rewriter by 3.1% due to changed behaviour of the inliner.