Factor out the triple of function, its reverse derivative and its forward derivative from AstMapAccumRDer and let the user provide handwritten derivatives using the same mechanism. If I'm not missing anything, this should be just the matter of a rather large refactoring of the whole code and inventing proper syntax for the surface API.