Text this: Typing termination in a higher-order concurrent imperative language