[Haskell-beginners] process with mutable state in haskell