A Functional Abstraction of Typed Invocation Contexts (Logical Methods in Computer Science, 2022)