Fold traverses macros

Fixes bug #2888 . Includes test cases

r? @catamorphism