[Haskell-beginners] Is this an appropriate use of the writer monad?