There&#39;s definitely a sneaky bug hiding somewhere.&nbsp; I&#39;m still looking for a simple test case, preferably independent of the imperative/legacy adapter code.&nbsp; - Conal<br><br><div class="gmail_quote">On Tue, Dec 16, 2008 at 3:04 PM, Peter Verswyvelen <span dir="ltr">&lt;<a href="mailto:bugfact@gmail.com">bugfact@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Ah yes, you are right. &nbsp;So, if I understood it correctly, it is the intention to use the partially evaluated data constructors to be able to pattern match against e.g. NoBound <span style="font-style: italic;">a</span>, even when <span style="font-style: italic;">a</span> is not computed yet. So yes, if an event has NoBound occurrences, and this event immediately provides NoBound for the next future value even when the exact time is not yet known, then I indeed don&#39;t see why the pattern match against MaxBound would block... Mmm, Bob?<div>
<div></div><div class="Wj3C7c"><div>
<div><div><div><div><br><div class="gmail_quote">On Tue, Dec 16, 2008 at 11:51 PM, Conal Elliott <span dir="ltr">&lt;<a href="mailto:conal@conal.net" target="_blank">conal@conal.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Time in Reactive has some structure.&nbsp; <br><br>&nbsp;&nbsp;&nbsp; type Time t = Max (AddBounds t)<br><br>Max adds a max-based Monoid instance.&nbsp; It&#39;s a newtype and so doesn&#39;t add any laziness/partiality.&nbsp; AddBounds, however, is a data type:<br>


<br>&nbsp;&nbsp;&nbsp; data AddBounds a = MinBound | NoBound a | MaxBound<br><br>Typically, the type parameter t in &#39;Time t&#39; is bound to &#39;Improving Double&#39;, which adds yet more partiality to times.<br><br>External inputs are represented by events whose occurrence times are wrapped with NoBound.&nbsp; The various matches against MaxBound then ought to fail immediately, without any examination of the improving double inside the NoBound.<br>


<br>That&#39;s my intention, anyway.&nbsp; There may be a bug somewhere that thwarts this trick.<br><br>I don&#39;t yet have a concrete example of the merge bug that Bob mentioned.&nbsp; Once I have one, I&#39;ll see what I can learn about it.<br>

<font color="#888888">
<br>&nbsp; - Conal</font><div><div></div><div><br><br><br><div class="gmail_quote">On Tue, Dec 16, 2008 at 1:00 PM, Peter Verswyvelen <span dir="ltr">&lt;<a href="mailto:bugfact@gmail.com" target="_blank">bugfact@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
But isn&#39;t just matching against MaxBound or MinBound enough to enforce the computation of the time value? And hence block when the event is not-never-occuring (hu that sounded weird)?<div><br><div class="gmail_quote">


2008/12/16 Conal Elliott <span dir="ltr">&lt;<a href="mailto:conal@conal.net" target="_blank">conal@conal.net</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">



Yes indeed. &nbsp;The issue is that if you know one of the events will never
happen again, what you want to do is stop merging, and throw the
never-occurring event in the bin. &nbsp;Unfortunately, to pattern match
against the never occurring event then blocks checking whether the
match works or not :(.</blockquote><div><br>I&#39;m trying to understand what the problem is here.&nbsp; I think the not-yet-known values are all wrapped with a NoBound and so should pass right by the MaxBound pattern matches without blocking.<br>




<br>&nbsp; - Conal<br></div><br><div class="gmail_quote">On Tue, Dec 16, 2008 at 2:56 AM, Thomas Davie <span dir="ltr">&lt;<a href="mailto:tom.davie@gmail.com" target="_blank">tom.davie@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<div><br>
On 16 Dec 2008, at 11:50, Claus Reinke wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">




<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Seems to be partially timer- and partially event-merge-related:<br>
if I compile with -threaded, the pieces do not move at all on their<br>
own, but as long as I keep pressing &quot;down&quot;, the game appears<br>
playable as intended; if I compile without -threaded, the pieces<br>
move occasionally, but the effects of keyboard input are entirely<br>
unpredictable.<br>
</blockquote>
<br>
I&#39;ve noticed this behavior in since the last couple of days, So at a &nbsp;guess a bug got introduced<br>
somewhere along the line. &nbsp;The merge issue &nbsp;is known -- at the moment, an occurrence doesn&#39;t<br>
appear in the output &nbsp;until it&#39;s known whether or not the other event ever occurs, which &nbsp;isn&#39;t<br>
ideal. &nbsp;Unfortunately, the obvious fix for the issue creates a &nbsp;large memory leak, I&#39;ve been<br>
playing with a few ways to fix this.<br>
</blockquote>
<br>
Thanks for the info, Tom,<br>
<br>
where can I find more details about this merge issue? Given that<br>
FRPLs are traditionally synchronously concurrent languages, this<br>
is rather surprising: when sampling anything, one knows about<br>
everything&#39;s values _now_, which should be sufficient for merge,<br>
no matter whether the other event might or might not happen later.<br>
</blockquote>
<br></div>
Yes indeed. &nbsp;The issue is that if you know one of the events will never happen again, what you want to do is stop merging, and throw the never-occurring event in the bin. &nbsp;Unfortunately, to pattern match against the never occurring event then blocks checking whether the match works or not :(. &nbsp;The particular interesting bit of code is in PrimReactive.hs (Conal&#39;s comments here):<br>





<br>
-- | Merge two &#39;Future&#39; streams into one.<br>
merge :: Ord t =&gt; Binop (FutureG t (ReactiveG t a))<br>
<br>
-- The following two lines seem to be too strict and are causing<br>
-- reactive to lock up. &nbsp;I.e. the time argument of one of these<br>
-- must have been _|_, so when we pattern match against it, we-- block.<br>
-- <br>
-- On the other hand, they patch a massive space leak in filterE. &nbsp;Perhaps<br>
-- there&#39;s an unamb solution.<br>
<br>
Future (Max MaxBound,_) `merge` v = v<br>
u `merge` Future (Max MaxBound,_) = u<br>
<br>
u `merge` v =<br>
 &nbsp;(inFutR (`merge` v) &lt;$&gt; u) `mappend` (inFutR (u `merge`) &lt;$&gt; v)<br>
<br>
-- What&#39;s going on in this &#39;merge&#39; definition? &nbsp;Try two different<br>
-- future paths. &nbsp;If u arrives before v (or simultaneously), then<br>
-- begin as u begins and then merge v with the rest of u. &nbsp;Otherwise,<br>
-- begin as v begins and then merge u with the rest of v. &nbsp;Because of<br>
-- the left-bias, make sure u fragments are always the first argument<br>
-- to merge and v fragments are always the second.<br>
<br>
<br>
Bob</blockquote></div><br>
<br></div></div>_______________________________________________<br>
Reactive mailing list<br>
<a href="mailto:Reactive@haskell.org" target="_blank">Reactive@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/reactive" target="_blank">http://www.haskell.org/mailman/listinfo/reactive</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br>
</div></div></blockquote></div><br></div></div></div></div></div>
</div></div></blockquote></div><br>