There’s two kinds of hooks I can imagine people wanting:
- Run some function before/after each REPL input/output.
- Transform each REPL AST input before evaluating it.
Of course, the latter is strictly more general since you can insert calls before and after the actual input expression to call hooks, but the former API is much simpler, so it may make some sense to have both? Would be worth filing an issue to discuss making this simpler and/or more official.