title: Can functional reactive programming (FRP) be expressed using monads?
body: <p>I've been reading up on <a href="http://en.wikipedia.org/wiki/Functional_reactive_programming" rel="nofollow noreferrer">Functional Reactive Programming</a>, and though I have not used monads extensively in any language, I can't help but see them <em>everywhere</em> in the FRP design.</p>
  
  <p><a href="https://stackoverflow.com/questions/1028250/what-is-functional-reactive-programming">This question's answers</a> have some fantastic descriptions of what functional reactive programming <em>is</em>, and I won't attempt to replicate that here. Basically, FRP creates relationships between values that change over time.</p>
  
  <p>So can't this be represented monadically? Encapsulate the code that requires the values that are modified over time in a monad, call it <code>Signal</code>, then use those signals like so (using Haskell do-notation for simplicity).</p>
  
  <pre><code>do
    mx &lt;- mouseX
    my &lt;- mouseY
    wave &lt;- currentTime &gt;&gt;= liftM sin
    -- do some stuff with these values
  </code></pre>
  
  <p>Or is there more to FRP than I'm understanding? Are there paradigms that prevent using such a simple representation using monads? Or is this a valid (if perhaps simplified) understanding of how FRP works?</p>