#45 refactoring tlssv.hs: make main loop out of StateT