[Haskell-beginners] Strange behavior of program