title: How to play with Control.Monad.Writer in haskell?
body: <p>I'm new to functional programming and recently learning at <a href="http://learnyouahaskell.com/" rel="noreferrer">Learn You a Haskell</a>, but when I went through <a href="http://learnyouahaskell.com/for-a-few-monads-more" rel="noreferrer">this chapter</a>, I got stuck with the program below:</p>
  
  <pre><code>import Control.Monad.Writer  
  
  logNumber :: Int -&gt; Writer [String] Int  
  logNumber x = Writer (x, ["Got number: " ++ show x])  
  
  multWithLog :: Writer [String] Int  
  multWithLog = do  
      a &lt;- logNumber 3  
      b &lt;- logNumber 5  
      return (a*b)
  </code></pre>
  
  <p>I saved these lines in a .hs file and but failed to import it into my ghci which complained:</p>
  
  <pre><code>more1.hs:4:15:
      Not in scope: data constructor `Writer'
      Perhaps you meant `WriterT' (imported from Control.Monad.Writer)
  Failed, modules loaded: none.
  </code></pre>
  
  <p>I examined the type by ":info" command:</p>
  
  <pre><code>Prelude Control.Monad.Writer&gt; :info Writer
  type Writer w = WriterT w Data.Functor.Identity.Identity
                 -- Defined in `Control.Monad.Trans.Writer.Lazy'
  </code></pre>
  
  <p>From my point of view, this was supposed to be something like "newtype Writer w a ..."
  so I'm confused about how to feed the data constructor and get a Writer.</p>
  
  <p>I guess it might be a version-related problem and my ghci version is 7.4.1</p>