title: Can reactive-banana handle cycles in the network?
body: <p>We have code like this:</p>
  
  <pre><code> guiState :: Discrete GuiState
   guiState = stepperD (GuiState []) $
     union (mkGuiState &lt;$&gt; changes model) evtAutoLayout
  
   evtAutoLayout :: Event GuiState
   evtAutoLayout = fmap fromJust . filterE isJust . fmap autoLayout $ changes guiState
  </code></pre>
  
  <p>You can see that evtAutoLayout feeds into guiState which feeds into
  evtAutoLayout--so there is a cycle there. This is deliberate. Auto
  layout adjusts the gui state until it reaches an equilibrium and then
  it returns Nothing and so it should stop the loop. A new model change
  can kick it off again, of course.</p>
  
  <p>When we put this together, though, we run into an infinite loop on the
  compile function call. Even if autoLayout = Nothing, it still results in a stack overflow during compile.</p>
  
  <p>If I remove the union call in guiState and remove evtAutoLayout out of
  the picture...</p>
  
  <pre><code> guiState :: Discrete GuiState
   guiState = stepperD (GuiState []) $ mkGuiState &lt;$&gt; changes model
  </code></pre>
  
  <p>it works fine.</p>
  
  <p>Any suggestions?</p>