[Haskell-beginners] Hints on how to remove unsafePerformIO from my function?