title: Haskell enumerator: analog to iteratees `enumWith` operator?
body: <p>Earlier today I wrote a small test app for iteratees that composed an iteratee for writing progress with an iteratee for actually copying data. I wound up with values like these:</p>
  
  <pre><code>-- NOTE: this snippet is with iteratees-0.8.5.0
  -- side effect: display progress on stdout
  displayProgress :: Iteratee ByteString IO ()
  
  -- side effect: copy the bytestrings of Iteratee to Handle
  fileSink :: Handle -&gt; Iteratee ByteString IO ()
  
  writeAndDisplayProgress :: Handle -&gt; Iteratee ByteString IO ()
  writeAndDisplayProgress handle = sequence_ [fileSink handle, displayProgress]
  </code></pre>
  
  <p>In looking at the enumerator library, I don't see an analog of <code>sequence_</code> or <code>enumWith</code>. All I want to do is compose two iteratees so they act as one. I could discard the result (it's going to be <code>()</code> anyway) or keep it, I don't care. (&amp;&amp;&amp;) from Control.Arrow is what I want, only for iteratees rather than arrows.</p>
  
  <p>I tried these two options:</p>
  
  <pre><code>-- NOTE: this snippet is with enumerator-0.4.10
  run_ $ enumFile source $$ sequence_ [iterHandle handle, displayProgress]
  run_ $ enumFile source $$ sequence_ [displayProgress, iterHandle handle]
  </code></pre>
  
  <p>The first one copies the file, but doesn't show progress; the second one shows progress, but doesn't copy the file, so obviously the effect of the built-in sequence_ on enumerator's iteratees is to run the first iteratee until it terminates and then run the other, which is not what I want. I want to be running the iteratees in parallel rather than serially. I feel like I'm missing something obvious, but in reading the <code>wc</code> example for the enumerator library, I see this curious comment:</p>
  
  <pre><code>-- Exactly matching wc's output is too annoying, so this example
  -- will just print one line per file, and support counting at most
  -- one statistic per run
  </code></pre>
  
  <p>I wonder if this remark indicates that combining or composing iteratees within the enumerations framework isn't possible out of the box. What's the generally-accepted right way to do this?</p>
  
  <p><strong>Edit</strong>:</p>
  
  <p>It seems as though there is no built-in way to do this. There's discussion on the Haskell mailing list about adding combinators like <a href="http://www.haskell.org/pipermail/haskell-cafe/2011-January/088319.html" rel="nofollow">enumSequence</a> and <a href="http://www.haskell.org/pipermail/haskell-cafe/2011-April/091474.html" rel="nofollow">manyToOne</a> but so far, there doesn't seem to be anything actually in the enumerator package that furnishes this capability.</p>