Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Two things:</p> <ol> <li><p>In Conal Elliott's original vision, behaviors are <em>continuous</em> in time, so they don't come with a function <code>changes</code> that indicates when they change.</p> <p>The behavior that returns the current clock time would be the prime example of a continuous behavior. It doesn't support a <code>changes</code> function, unless you specify a time step ("it generates a 'change' event every nanosecond"). But the point of "continuous" is the lack of a time step.</p> <p>In my view, this means that behaviors in Conal's sense don't support incremental updates at all. In my <a href="http://haskell.org/haskellwiki/Reactive-banana" rel="nofollow">reactive-banana</a> library, I have introduced a new data type <code>Discrete</code> that is some kind of hybrid between behaviors and events. See the documentation of the module <a href="http://hackage.haskell.org/packages/archive/reactive-banana/0.4.2.0/doc/html/Reactive-Banana-Incremental.html" rel="nofollow">Reactive.Banana.Incremental</a> for more details on the rationale.</p></li> <li><p>You are probably annoyed by having wrap each and every GUI function like <code>setBackground</code> to make it work with behaviors instead of plain values. This is were higher-order functions really shine: the wrapper is always the same, you can express it as a higher order function; here a Haskell version:</p> <pre><code>set' :: Property a -&gt; Behavior a -&gt; IO () set' property behavior = do set property (now behavior) each (\a -&gt; set property a) (changes behavior) each f event = reactimate (fmap f event) -- helper definition example = set' background red </code></pre> <p>Of course, this relies a lot on Haskell's syntax and may not be as pleasant in Scala, where some functions are written before their first argument.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload