Relating Functional and Imperative Session Types (Logical Methods in Computer Science, 2022)