[Haskell-cafe] Announcement - HGamer3D - 0.2.1 - why netwire

Heinrich Apfelmus apfelmus at quantentunnel.de
Sun Mar 24 10:18:40 CET 2013


Ertugrul Söylemez wrote:
> Heinrich Apfelmus <apfelmus at quantentunnel.de> wrote:
> 
>> You said that reactive-banana didn't feel as simple after the
>> introduction of dynamic event switching, though. Could you pinpoint
>> some particular thing that made you feel like that? Maybe a type
>> signature or a tutorial or something else? I took great care trying to
>> make the dynamic event switching stuff entirely optional, so you can
>> use reactive-banana without understanding it at all, but I'm not sure
>> if I succeeded.
> 
> I think this is less of an issue with reactive-banana than with classic
> FRP in general.  The type signatures of Netwire can be scary at first
> sight, but they are consistent throughout the entire library.  Once you
> understand one of these type signatures you understand all of them.
> Once you know how to use one wire, you know how to use all others.
> 
> Let me pinpoint something in particular: events.  In reactive-banana
> events are special, in Netwire they are not.  This makes dynamic
> switching special in reactive-banana and natural in Netwire.  Let me
> show you an example:  You want to dispaly "one" for ten seconds, then
> "two" for twelve seconds, then start over:
> 
>     myWire =
>         "one" . for 10 -->
>         "two" . for 12 -->
>         myWire
> 
> Events and particularly dynamic event switching is one of the main
> problems Netwire solves elegantly.  You can add this to reactive-banana,
> too, but it would require changing almost the entire event interface.

I concur that chaining wires with the  andThen  combinator is very 
slick, I like it a lot. Wolfgang Jeltsch recently described a similar 
pattern for classical FRP, namely a behavior that doesn't live forever, 
but actually ends at some point in time, which can be interpreted as an 
event occurrence. ("It ends with a bang!")


However, do note that the  andThen  combinator in netwire can only be so 
slick because "switching restarts time" (as the documentation puts it). 
I don't see a nice way to switch between wires that have accumulated 
state. How would you express the TwoCounters example [1] using dynamic 
event switching in netwire? (The example can be implemented without 
dynamic event switching, but that's not what I mean.) What about the 
BarTab example [2]?

   [1]: 
http://www.haskell.org/haskellwiki/Reactive-banana/Examples#twoCounters
   [2]: http://www.haskell.org/haskellwiki/Reactive-banana/Examples#bartab


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com




More information about the Haskell-Cafe mailing list