Text this: Relating Functional and Imperative Session Types