Re: [Haskell-cafe] coding a queue with reactive

2011-02-16 Thread sam . roberts . 1983
Thanks, Ryan. I think I unppderstand the idea behind your function, which is a lot cleaner then my first queue implementation. I'm not sure if I could have quite programmed it from scratch yet, but that will come in time! I had to fix up a little bit of glue code to get your suggestions to compil

Re: [Haskell-cafe] coding a queue with reactive

2011-02-14 Thread Ryan Ingram
One way to think about Reactive's notion of "Future" is as a single element of an event stream--something that might happen (yielding a value) some time in the future. 'mempty' on futures is a future that never happens, and 'mappend' says to pick the first of two futures to happen. m >>= k waits f

Re: [Haskell-cafe] coding a queue with reactive

2011-02-13 Thread sam . roberts . 1983
On , Ryan Ingram wrote: Hi Sam. I don't know much about the performance problems you are seeing, but I think your solution is more cleanly implemented just under the event level with futures. I think the reactive function you want has a type like this: stateMachine :: s -> (a -> s -> s) ->

Re: [Haskell-cafe] coding a queue with reactive

2011-02-11 Thread Ryan Ingram
Hi Sam. I don't know much about the performance problems you are seeing, but I think your solution is more cleanly implemented just under the event level with futures. I think the reactive function you want has a type like this: stateMachine :: s -> (a -> s -> s) -> (s -> Future (b, s)) -> Event

[Haskell-cafe] coding a queue with reactive

2011-02-09 Thread sam . roberts . 1983
Hi all, I hope someone is interested in helping me out with the reactive library. I am trying to implement a function "queue" in reactive: queue :: Double -> Event a -> Event a This is a simple queue: events from the event stream coming into the queue, queue up waiting to be processed one by on