Pipeline stages

Some simple utility pipeline stages are predefined here. All pipeline stages are implemented as inline constexpr callable function objects with a transform::pipeline return type, that for readability here are documented as functions.

transform::pipeline id();

Does nothing and replays its source as-is.

transform::pipeline composed(transform::pipeline first, transform::pipeline second);

Composes first and second into a single pipeline stage. This is also callable with an overloaded bitwise or operation (the pipe symbol) as follows:

transform::pipeline pipe = id() | map(...);
transform::pipeline map(std::function<type(type)> types_map, std::function<term(term)> terms_map, std::function<term(term)> back_map);

Maps types_map and terms_map to any type or term, respectively, appearing in the source declarations/definitions/statements. Uses back_map to implement transform::base::undo().