title: Representing timestamps
body: <p>I would like to represent the timestamp coming from an <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement" rel="nofollow noreferrer"><code>HTMLMediaElement</code></a>. Its defining characteristics are:</p>
  
  <ul>
  <li>Its value is represented as a <code>Double</code></li>
  <li>It can be queried at any time using <code>getCurrentTime :: IO Double</code> (as partially applied on a given <code>HTMLMediaElement</code>)</li>
  <li>It is potentially continuously changing (whenever the media player is playing)</li>
  </ul>
  
  <p>My initial plan was to <a href="https://stackoverflow.com/q/35957463/477476">represent it as a <code>Behavior t Double</code> that re-runs the <code>IO Double</code> every time it is observed</a>, but that hasn't worked out too well. </p>
  
  <p>Things I've tried:</p>
  
  <ul>
  <li>Using a <code>Behavior</code> that is prodded under the hood at a fixed frequency, as described in <a href="https://stackoverflow.com/q/35957463/477476">the workaround section of this question</a></li>
  <li>Passing an <code>Event t ()</code> representing the desired sampling frequency, and returning an <code>Event t Double</code> that holds the coinciding timestamps</li>
  </ul>
  
  <p>I don't really like either -- the first one either couples the <em>behaviour</em> (sorry) too much to my specific use case (if I use the eventual sampling frequency I'll use in my app) or seems wasteful (if I use something like 1 kHz sampling when creating the <code>Behavior</code> just to then sample it at 60 Hz on the application end), and the second is quite inflexible if you want to do more than one thing with the timestamp at different sampling rates.</p>