[Haskell-beginners] IO loops with tail call