Is there a way to pass value and doc arguments to f callback in this case?