This script simulates IO (print and input) in a pure functional manner using a coinductive data structure.
Python-compatible generator:
Generator yield send return = ∃state . state × (state → return + yield × (send → state))
With the point functor:
F yield send return state = return + yield × (send → state)
Generator needed for IO:
Generator yield send return = ∃state . state × (state → return + yield × state + (send → state))
With the point functor:
F yield send return state = return + yield × state + (send → state)
IO definition:
IO = Generator str str