High-order abstraction for reducible data structures