Thanks, Ryan. I think I unppderstand the idea behind your function, <br />which is a lot cleaner then my first queue implementation.<br />I&#39;m not sure if I could have quite programmed it from scratch <br />yet, but that will come in time!<br /><br />I had to fix up a little bit of glue code to get your suggestions <br />to compile. I&#39;ve added the resulting code below. I&#39;m sure it can <br />be improved (e.g.., the time type constraints I added to the queue <br />function seem overly restrictive), but for now it works. <br /><br />&gt; module DraftQueue where<br /><br />&gt; import Data.Monoid<br />&gt; import Control.Applicative<br />&gt; import FRP.Reactive<br />&gt; import FRP.Reactive.Improving<br />&gt; import Data.AddBounds<br />&gt; import FRP.Reactive.Future<br />&gt; import FRP.Reactive.Internal.Reactive<br />&gt; import FRP.Reactive.Internal.Future<br /><br /><br />&gt; stateMachine :: (Ord t, Bounded t) =&gt; s -&gt; (a -&gt; s -&gt; s) -&gt; (s -&gt; FutureG t (b, s)) -&gt; EventG t a -&gt; EventG t b<br />&gt; <br />&gt; stateMachineF s0 upd run (Event inp) = do<br />&gt;    x &lt;- mappend (Left &lt;$&gt; run s0) (Right &lt;$&gt; inp)<br />&gt;    case x of<br />&gt;        Left (b,sNext) -&gt; return (Stepper b (stateMachine sNext upd run (Event inp)))<br />&gt;        Right (Stepper a inpNext) -&gt; stateMachineF (upd a s0) upd run inpNext<br />&gt; <br />&gt; stateMachine s0 upd run inp = Event $ stateMachineF s0 upd run inp<br /><br /><br />&gt; queue :: (Num t, Ord t) =&gt; t -&gt; EventG (Improving (AddBounds t)) a -&gt; EventG (Improving (AddBounds t)) a<br />&gt; queue delay = stateMachine Nothing upd run . withTimeE where<br />&gt;    improve = exactly . NoBound<br />&gt;    run Nothing = mempty<br />&gt;    run (Just (t, a, q)) = future (improve t) (a, sNext) where<br />&gt;        sNext = fmap (\(a&#39;, q&#39;) -&gt; (t + delay, a&#39;, q&#39;)) (viewQ q)<br />&gt;    upd (x, time) Nothing = Just (time + delay, x, emptyQ)<br />&gt;    upd (x, time) (Just (t, a, q)) = Just (t, a, pushQ x q)<br /><br />Thanks for all your help,<br />Sam