title: Accumulating events with a resettable initial value
body: <p>I need a function like <code>accumB</code>, but I would like the initial value to be a <code>Behavior</code> instead of a constant. When the initial value changes, the accumulator should 'reset' and start accumulating from that value. Concretely, for the following code and sequence of events:</p>
  
  <pre><code>accumB' :: Behavior a -&gt; Event (a -&gt; a) -&gt; IO (Behavior a)
  accumB' (stepper 0 ev) ((+) &lt;$&gt; ev')
  
  ev' -&gt; 1
  ev' -&gt; 1
  ev -&gt; 5
  ev' -&gt; 1
  </code></pre>
  
  <p><code>accumB'</code> should return a step function of values <code>0, 1, 2, 5, 6</code>.</p>
  
  <p>Is this possible with the combinators currently available in Threepenny, or does it require support for dynamic switching? (I think the answer is 'no', so I'm currently trying to implement my own <code>accumB'</code> in terms of <code>IORef</code>s...) And if not, is <code>accumB'</code> as described above semantically well-defined, or should I be using an <code>Event a</code> for my time-varying initial value instead?</p>