a simple io loop in haskell