I have an algebraic data type for an AST, which takes a type parameter for the type of expression that the AST holds. I’m writing a function which walks the AST, transforming certain nodes, but always keeping the types of the nodes the same. For example, I can provide this function a function for transforming identifiers (like for renaming them), but the transformer has to return another identifier. The outer structure of the AST stays the same. This is important because I only want to specify transformation functions for the “interesting” cases, and allow the majority of cases to use a default transformer which does nothing more than traverse down the node’s children.
What would you name such a thing? I wouldn’t call it “map” because it doesn’t change the type parameter. It’s not “fold” because it doesn’t have the ability to vary the return type at all. It might be a special case of some other morphism, which would be helpful, but I’m not seeing it.