<div dir="ltr"><div><div><div>We do have them in Dunai [1], which combines both arrowized and classic FRP in an efficient and elegant solution. Yampa [2] (Arrowized FRP) can be built on top of Dunai and we have real games and apps running on top of this [3].<br><br></div>The issue is described very well in Section 2, "Efficient and Compositional Higher-Order Streams", by Gergely Patai [4].</div><div><br></div>Ivan<br><br></div>[1] <a href="http://github.com/ivanperez-keera/dunai">http://github.com/ivanperez-keera/dunai</a><br>[2] <a href="http://github.com/ivanperez-keera/Yampa">http://github.com/ivanperez-keera/Yampa</a><br>[3] <a href="http://www.cs.nott.ac.uk/~psxip1/#FRPRefactored">http://www.cs.nott.ac.uk/~psxip1/#FRPRefactored</a><br><div>[4] <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.182.2374&rep=rep1&type=pdf">http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.182.2374&rep=rep1&type=pdf</a></div><div><div class="gmail_extra"><br><div class="gmail_quote">On 20 January 2018 at 09:00, martin <span dir="ltr"><<a href="mailto:martin.drautzburg@web.de" target="_blank">martin.drautzburg@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello all,<br>
<br>
it appears to be difficult to define a Monad instance for Behavior and in many (if not all) reactive libraries Behavior<br>
is not a Monad. Why is that so?<br>
<br>
If a Beahvior is conceptionally a function from Time to something,<br>
<br>
newtype Behavior a = Behavior (Time -> a)<br>
<br>
then its Monad instance should work like a Reader Monad.<br>
<br>
Alternatively one can look at the join function<br>
<br>
join :: Behavior (Behavior a) -> Behavior a.<br>
<br>
This corresponds to the situation where you switch between Channels on a TV remote controle and each Channel is a<br>
behavior of Image. Then<br>
<br>
join Behavior (Behavior image)<br>
<br>
should give you the video stream you see on the screen. How can one possibly live without this operation?<br>
<br>
I assume this has something to do with the actual implementation and not so much with the semantics, because<br>
semantically I don't see any problems.<br>
<br>
So,<br>
- why is Behavior not a Monad and<br>
- how would you express the TV-remote example without a Monad?<br>
<br>
<br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/haskell-caf<wbr>e</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br></div></div></div>