title: Printing Pascal's triangle in Haskell
body: <p>I just started learning Haskell, and have been doing a few problems online. Most of the times, I can figure out the solution but I am unable to print it out in the output format that is expected. </p>
  
  <p>For example, I tried doing a Pascal's triangle program. I found out how to generate Pascal's Triangle as a list of lists of Ints, but I cant figure out how to print it.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>import Data.List
  pascal n = map liner [0..n]
      where liner x = map (comb x) [0..x]
  
  comb n 0 = 1
  comb 0 r = 0
  comb n r = comb (n-1) (r-1) * n `div` r 
  
  main = do
      order &lt;- getLine
      let output = pascal . (read :: String -&gt; Int) $ order
      print output 
  </code></pre>
  
  <p>Currently, the output is like </p>
  
  <pre><code>[[1],[1,1],[1,2,1],[1,3,3,1]...
  </code></pre>
  
  <p>I want to print it in the form </p>
  
  <pre><code>1
  1 1
  1 2 1
  1 3 3 1
  ...
  </code></pre>
  
  <p>How do I do this? I have tried using things like mapM_ or intercalate " ", with no luck. I'm not into monads yet so I don't understand how mapM works.</p>