I think this topic is covered in Andrew Gordon's dissertation/book:
Functional programming and input/output by Andrew D. Gordon
You can read it online.
Cheers,
Paul