[Haskell-beginners] FRP

Heinrich Apfelmus apfelmus at quantentunnel.de
Sun Sep 16 18:24:41 CEST 2012


Christopher Howard wrote:
> On 09/15/2012 11:16 PM, Ertugrul Söylemez wrote:
>> Summary:  FRP is about handling time-varying values like they were
>> regular values.
>>
> 
> Ouch!... Ouch!... My head is beginning to explode!
> 
> So, I think I understand the main idea you just explained, but now I am
> curious about how this black magic is possible. Presumably, these
> mystical "time-varying values" would actually have to be some kind of
> partially applied function that receives a time parameter. But how do
> we, as in your example, add a literal number to a function?

As Ertugrul indicated, you first turn the literal number into a function 
(namely the constant function) and then perform arithmetic with that 
function.


I have a few slides that may useful in understanding the "time-varying 
values as ordinary values" point better

   http://apfelmus.nfshost.com/blog/2012/07/15-frp-tutorial-slides.html

Of course, keep in mind that at the end of the day, the  Behavior  and 
Event  types are going to be opaque. This is because the literal 
Behavior a = Time -> a  implementation would be very inefficient.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com




More information about the Beginners mailing list