<div dir="ltr">Sadly, the presentation is only 20 minutes long, including questions, so I have no time to talk about the implementation at all :(<div><br></div><div>However, I'd be happy to answer any questions you have in person, as well as via mail :)</div><div><br></div><div>Cheers,</div><div><br></div><div>Atze</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-24 17:14 GMT+02:00 Michael Jones <span dir="ltr"><<a href="mailto:mike@proclivis.com" target="_blank">mike@proclivis.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Atze,<div><br></div><div>Will the magic be revealed during your presentation next week? I guess I better take the paper on the plane and read it 3 more times before I get there :-)</div><div><br></div><div>Mike</div><div><div class="h5"><div><br><div><blockquote type="cite"><div>On Aug 24, 2015, at 9:08 AM, Atze van der Ploeg <<a href="mailto:atzeus@gmail.com" target="_blank">atzeus@gmail.com</a>> wrote:</div><br><div><div dir="ltr">This is the magic of the implementation, as well as Haskell. Very funky indeed. The paper describes it, but I must admit it is all pretty tricky :)</div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-24 17:01 GMT+02:00 Michael Jones <span dir="ltr"><<a href="mailto:mike@proclivis.com" target="_blank">mike@proclivis.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Atze,<div><br></div><div>Ah, now it is more clear what the intended representation is.</div><div><br></div><div>Let me address the point about recursion, which reflects more or less my difficulty understanding how a stream produces values in time.</div><div><br></div><div>Referencing the paper version:</div><div><br></div><div><span><div><div>newtype Stream a = S { next :: B (E a) }</div></div><div><br></div></span><div><span><div>catMaybesStream :: Stream (Maybe a) -> Stream a</div><div>catMaybesStream (S s) = S loop where</div><div>  loop = do  e <- s</div><div>             join <$> plan (nxt <$> e)</div><div>--  nxt :: Maybe a -> B (E a)</div><div>  nxt (Just a) = return (return a)</div><div>  nxt Nothing  = loop</div><div><br></div></span><div>loop references nxt, and nxt references loop, hence my use of the word ‘recursion’. But perhaps saying ‘data’ is incorrect. My intuition says that the ‘a’ in B (E a) must be a Stream for the ‘recursion’ to work. What then really twists my mind up is ‘e <-s’ getting the next value n times. I’m not an expert in how Haskell evaluates these expressions, but I really would like to understand how that works, because my old ‘imperative’ mind is in need of an upgrade.</div><div><br></div><div>Mike</div></div></div><div><div><div><br><div><blockquote type="cite"><div>On Aug 24, 2015, at 8:50 AM, Atze van der Ploeg <<a href="mailto:atzeus@gmail.com" target="_blank">atzeus@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Hi Mike, cafe,<div><br></div><div>The implementation in the library is essentially the same as in the paper, but B (E [a]) instead of B (E a) allows multiple simultaneous events, whereas the implementation in the paper does not. The result is B (E [a]), where the list is the list of all results in the event stream which occur at that point. Like the implementation in the paper, the behavior switches as soon as the next event occurs.</div><div><br></div><div>I'm a bit unclear on your question, neither implementation is recursive. If you want to use event streams it's best not to look at their implementation, which is tricky, but just use the combinators that are available. </div><div>You can create a behavior that always give the integration of the values in the eventstream as follows:</div><div><br></div><div>integrate :: EvStream (Double,Double) -> Double -> Behavior (Behavior Double)</div><div>integrate stream startTime = foldEs update (0,startTime) stream where</div><div>  update (total, prevTime) (cur, curTime) = let diff = curTime - prevTime * cur </div><div>                                                                    in (total + diff, curTime)</div><div><br></div><div>Or use Control.FRPNow.Time.integrate :)</div><div><br></div><div>The result will give a Behavior (Behavior Double), because the result depends on when we start integrating to prevent the space leak. Does that answer your question? </div><div><br></div><div>Cheers,</div><div><br></div><div>Atze</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-24 16:15 GMT+02:00 Michael Jones <span dir="ltr"><<a href="mailto:mike@proclivis.com" target="_blank">mike@proclivis.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><div>Atze,</div><div><br></div><div>I have a question about Streams.</div><div><br></div><div>In the Paper Impl the following code:</div><div><br></div><div>newtype Stream a = S { next :: B (E a) }</div></div><div><br></div><div><div>catMaybesStream :: Stream (Maybe a) -> Stream a</div><div>catMaybesStream (S s) = S loop where</div><div>  loop = do  e <- s</div><div>             join <$> plan (nxt <$> e)</div><div>--  nxt :: Maybe a -> B (E a)</div><div>  nxt (Just a) = return (return a)</div><div>  nxt Nothing  = loop</div></div><div><br></div><div>Which I understand.</div><div><br></div><div>And in the library the following code:</div><div><br></div><div>newtype EvStream a = S { getEs :: Behavior (Event [a]) }</div></div><div><br></div><div><br></div><div>catMaybesEs :: EvStream (Maybe a) -> EvStream a</div><div>catMaybesEs s = S $ loop where</div><div>--  loop :: Behavior (Event [a])</div><div>  loop = do  e <- getEs s</div><div>             join <$> plan (nxt <$> e)</div><div>  nxt l = case  catMaybes l of</div><div>             [] -> loop</div><div>             l  -> return (return l)</div></div><div><br></div><div>I assume the new type EvStream the intent is for the stream of ‘a’ to be an array rather than a recursive data structure, based on the name ‘getEs’.</div><div><br></div><div>But, catMaybeEs is written like the paper version, suggesting it is a recursive data structure arrays.</div><div><br></div><div>My goal is to write an integrator for a stream, such that the type signature is:</div><div><br></div><div>EvStream (Double,Double) -> EvStream (Double)</div><div><br></div><div>where the tuple is (data, time) and the result is (integratedData)</div><div><br></div><div>and I modeled the function catMaybeEs, but it is not working. So I want to understand the general way to handle the stream in catMaybesEs.</div><div><br></div><div>Mike</div><div><br></div><br><div><blockquote type="cite"><div><div><div>On Jul 15, 2015, at 7:25 AM, Atze van der Ploeg <<a href="mailto:atzeus@gmail.com" target="_blank">atzeus@gmail.com</a>> wrote:</div><br></div></div><div><div><div><div dir="ltr"><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">Dear Cafe,</span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">We have released the (nearly) first version of FRPNow, the functional reactive programming library based on the ICFP 2015 paper "Principled Practical FRP: Forget the Past, Change the Future, FRPNow!" (<a href="https://www.reddit.com/r/haskell/comments/3ai7hl/principled_practical_frp_forget_the_past_change/" target="_blank">https://www.reddit.com/r/haskell/comments/3ai7hl/principled_practical_frp_forget_the_past_change/</a>)</span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">The main package: <a href="http://hackage.haskell.org/package/frpnow" target="_blank">http://hackage.haskell.org/package/frpnow</a></span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">Examples: <a href="https://github.com/atzeus/FRPNow/tree/master/Examples" target="_blank">https://github.com/atzeus/FRPNow/tree/master/Examples</a></span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">Gloss interoperability: <a href="http://hackage.haskell.org/package/frpnow-gloss" target="_blank">http://hackage.haskell.org/package/frpnow-gloss</a></span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">GTK interoperability: <a href="http://hackage.haskell.org/package/frpnow-gtk" target="_blank">http://hackage.haskell.org/package/frpnow-gtk</a></span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">(hackage doesn't like the newer GTK docs, so you can read the docs at <a href="http://www.cse.chalmers.se/~atze/frpnow-gtk/" target="_blank">http://www.cse.chalmers.se/~atze/frpnow-gtk/</a> </span></font><span style="font-size:14px;line-height:20px;color:rgb(77,87,99);font-family:verdana,arial,helvetica,sans-serif">)</span></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px"><br></span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">Cheers,</span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px"><br></span></font></div><div style="margin:0px 0px 0.357142857142857em;padding:0px"><font color="#4d5763" face="verdana, arial, helvetica, sans-serif"><span style="font-size:14px;line-height:20px">Atze</span></font></div></div></div></div><span>
_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br></span></div></blockquote></div><br></div></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>