title: Template Haskell: zipn
body: <p>I was reading a <a href="http://replay.web.archive.org/20090421010040/http://www.haskell.org/bz/th3.htm" rel="nofollow">Template Haskell tutorial</a> from archive.org since it was lost from haskell.org, and noticed that it is corrupted, as if random parts had been taken out.</p>
  
  <p>I was hoping to read about their implementation of zipn. The only code they have there is:</p>
  
  <pre><code>\ y1 y2 y3 ­&gt;
    case (y1,y2,y3) of
      (x1:xs1,x2:xs2,x3:xs3) ­&gt; (x1,x2,x3) : ff xs1 xs2 xs3
      (_,_,_) ­&gt; []
  
  mkZip :: Int ­&gt; Expr ­&gt; Expr
  mkZip n name = lam pYs (caseE (tup eYs) [m1,m2])
    where
      (pXs, eXs) = genPE "x" n
      (pYs, eYs) = genPE "y" n
      (pXSs,eXSs) = genPE "xs" n
      pcons x xs = [p| $x : $xs |]
      b = [| $(tup eXs) : $(apps(name : eXSs)) |] 
      m1 = simpleM (ptup (zipWith pcons pXs pXSs)) b
      m2 = simpleM (ptup (copies n pwild)) (con "[]")
  </code></pre>
  
  <p>This makes no sense to me. Does anyone have a good copy of the tutorial? Or is what's on archive.org what it is?</p>