Allow to change fold function from inside