Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-29 Thread Heinrich Apfelmus
Ryan Ingram wrote: Heinrich Apfelmus wrote: However, even in a demand-driven implementation, there is one optimization that I would like make: when there are multiple external events, say e1 and e2, the network splits into subnetworks that react only to one of the inputs. For instance, your

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-28 Thread Ryan Ingram
On Tue, Apr 26, 2011 at 11:44 PM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: However, even in a demand-driven implementation, there is one optimization that I would like make: when there are multiple external events, say e1 and e2, the network splits into subnetworks that react only

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-27 Thread Heinrich Apfelmus
Ryan Ingram wrote: Apfelmus, I hope you don't abandon your efforts, at least for the selfish reason that I enjoy reading your blog entries about trying to implement it! :D My reasoning was that a temporary demand-driven implementation would allow me to release the library sooner; I want

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-26 Thread Heinrich Apfelmus
Edward Amsden wrote: As far as I can tell, with classic FRP implementations (those which use behaviors as a first-class abstraction), the only way to create a behavior or event based on some external input (for instance keypresses or microphone input) is to do something with unsafePerformIO or

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-26 Thread Ryan Ingram
Apfelmus, I hope you don't abandon your efforts, at least for the selfish reason that I enjoy reading your blog entries about trying to implement it! I was looking at your last entry and trying to understand if/how you solve the order-dependency problem for events. In particular: source events

[Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-25 Thread Edward Amsden
As far as I can tell, with classic FRP implementations (those which use behaviors as a first-class abstraction), the only way to create a behavior or event based on some external input (for instance keypresses or microphone input) is to do something with unsafePerformIO or unsafeInterleaveIO. A

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-25 Thread Ryan Ingram
Of course, you could have the 'interpretation' function be non-pure. For example: -- Library functions for a hypothetical FRP system pollEvent :: IO [a] - Event a behavior :: a - Event a - Behavior a accumB :: b - (b - a - b) - Event a - Behavior b accumE :: b - (b - a - b) - Event a - Event b

Re: [Haskell-cafe] Inputs to classic FRP: unsafeInterleaveIO/unsafePerformIO

2011-04-25 Thread Ryan Ingram
Mail fail, haha. Code fixed. For example: -- Library functions for a hypothetical FRP system pollEvent :: IO [a] - Event a behavior :: a - Event a - Behavior a accumB :: b - (b - a - b) - Event a - Behavior b accumE :: b - (b - a - b) - Event a - Event b union :: Event a - Event a - Event a