<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><div class=""><div class="">Atze,</div><div class=""><br class=""></div><div class="">I have a question about Streams.</div><div class=""><br class=""></div><div class="">In the Paper Impl the following code:</div><div class=""><br class=""></div><div class="">newtype Stream a = S { next :: B (E a) }</div></div><div class=""><br class=""></div><div class=""><div class="">catMaybesStream :: Stream (Maybe a) -> Stream a</div><div class="">catMaybesStream (S s) = S loop where</div><div class=""> loop = do e <- s</div><div class=""> join <$> plan (nxt <$> e)</div><div class="">-- nxt :: Maybe a -> B (E a)</div><div class=""> nxt (Just a) = return (return a)</div><div class=""> nxt Nothing = loop</div></div><div class=""><br class=""></div><div class="">Which I understand.</div><div class=""><br class=""></div><div class="">And in the library the following code:</div><div class=""><br class=""></div><div class="">newtype EvStream a = S { getEs :: Behavior (Event [a]) }</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">catMaybesEs :: EvStream (Maybe a) -> EvStream a</div><div class="">catMaybesEs s = S $ loop where</div><div class="">-- loop :: Behavior (Event [a])</div><div class=""> loop = do e <- getEs s</div><div class=""> join <$> plan (nxt <$> e)</div><div class=""> nxt l = case catMaybes l of</div><div class=""> [] -> loop</div><div class=""> l -> return (return l)</div></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">But, catMaybeEs is written like the paper version, suggesting it is a recursive data structure arrays.</div><div class=""><br class=""></div><div class="">My goal is to write an integrator for a stream, such that the type signature is:</div><div class=""><br class=""></div><div class="">EvStream (Double,Double) -> EvStream (Double)</div><div class=""><br class=""></div><div class="">where the tuple is (data, time) and the result is (integratedData)</div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">Mike</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 15, 2015, at 7:25 AM, Atze van der Ploeg <<a href="mailto:atzeus@gmail.com" class="">atzeus@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">Dear Cafe,</span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">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/" class="">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;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">The main package: <a href="http://hackage.haskell.org/package/frpnow" class="">http://hackage.haskell.org/package/frpnow</a></span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">Examples: <a href="https://github.com/atzeus/FRPNow/tree/master/Examples" class="">https://github.com/atzeus/FRPNow/tree/master/Examples</a></span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">Gloss interoperability: <a href="http://hackage.haskell.org/package/frpnow-gloss" class="">http://hackage.haskell.org/package/frpnow-gloss</a></span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">GTK interoperability: <a href="http://hackage.haskell.org/package/frpnow-gtk" class="">http://hackage.haskell.org/package/frpnow-gtk</a></span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">(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/" class="">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" class="">)</span></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class=""><br class=""></span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">Cheers,</span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class=""><br class=""></span></font></div><div style="margin: 0px 0px 0.357142857142857em; padding: 0px;" class=""><font color="#4d5763" face="verdana, arial, helvetica, sans-serif" class=""><span style="font-size:14px;line-height:20px" class="">Atze</span></font></div></div>
_______________________________________________<br class="">Haskell-Cafe mailing list<br class=""><a href="mailto:Haskell-Cafe@haskell.org" class="">Haskell-Cafe@haskell.org</a><br class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe<br class=""></div></blockquote></div><br class=""></body></html>